fork download
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. int main()
  5. {
  6. int test;
  7. int gruzzlers;
  8. int cakes_in_box;
  9. int g1eat_time;
  10. int g2eat_time;
  11. int g3eat_time;
  12. int t24h = 24*60*60;
  13. int g1cakes_eat_in24h;
  14. int g2cakes_eat_in24h;
  15. int g3cakes_eat_in24h;
  16. int x;
  17.  
  18. std::cin >> test;
  19.  
  20. for (int i=1; i<=test; i++)
  21. {
  22.  
  23. std::cin >> gruzzlers >> cakes_in_box;
  24. std::cin >> g1eat_time;
  25. std::cin >> g2eat_time;
  26. g1cakes_eat_in24h= t24h / g1eat_time;
  27. g2cakes_eat_in24h= t24h / g2eat_time;
  28.  
  29. if (gruzzlers==3)
  30. {
  31. std::cin >> g3eat_time;
  32. g3cakes_eat_in24h= t24h / g3eat_time;
  33.  
  34. x = ((g1cakes_eat_in24h+g2cakes_eat_in24h+g3cakes_eat_in24h)/cakes_in_box);
  35. if (((g1cakes_eat_in24h+g2cakes_eat_in24h+g3cakes_eat_in24h)%cakes_in_box)!=0)
  36. {
  37. x++;
  38. }
  39. std::cout << x << std::endl;
  40.  
  41. }
  42. if (gruzzlers==2)
  43. {
  44. x = ((g1cakes_eat_in24h+g2cakes_eat_in24h)/cakes_in_box);
  45. if (((g1cakes_eat_in24h+g2cakes_eat_in24h)%cakes_in_box)!=0)
  46. {
  47. x++;
  48. }
  49. std::cout << x << std::endl;
  50. }
  51. }
  52.  
  53. return 0;
  54. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty