fork download
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5. float czas;
  6. int testy,obzartuchy,ile_ciastek[100],suma=0, ciastka_w_pudelku;
  7. int main()
  8. {
  9.  
  10. cin>>testy;
  11. for(int i=0; i<testy; i++)
  12. {
  13. cin>>obzartuchy>>ciastka_w_pudelku;
  14. if(((ciastka_w_pudelku<1)||(obzartuchy<1))||((ciastka_w_pudelku<1)&&(obzartuchy<1)))
  15. {
  16. cout<<suma<<endl;
  17. goto a;
  18. }
  19. else
  20. {
  21. for(int i=0; i<obzartuchy; i++)
  22. {
  23.  
  24. cin>>czas;
  25. if(czas<0) goto a;
  26. else
  27. ile_ciastek[i]=86400/czas;
  28. suma+=ile_ciastek[i];
  29.  
  30. }
  31.  
  32.  
  33. cout<<ceil((double)suma/ciastka_w_pudelku)<<endl;
  34. a:
  35. suma=0;
  36. }
  37. }
  38. return 0;
  39. }
  40.  
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
Standard output is empty