fork download
  1. //???
  2. #include <bits/stdc++.h>
  3. #define ll long long
  4. #define ld long double
  5. using namespace std;
  6.  
  7. int main() {
  8. freopen("cheeseburger_corollary_2_input.txt", "r", stdin);
  9. freopen("output.txt", "w", stdout);
  10. ll t;
  11. cin>>t;
  12. ll p=t;
  13. while(t--) {
  14. //cout<<p<<endl;
  15. cout<<"Case #"<<p-t<<":"<<" ";
  16. ll a,b,c;
  17. cin>>a>>b>>c;
  18. ll out=0;
  19. if(a>=b) {
  20. ll pot=c/b;
  21. pot=pot*2;
  22. out=pot-1;
  23. }
  24. else if(a<=(b/2)) {
  25. ll pot=c/a;
  26. out=pot;
  27. }
  28. else {
  29. ll pot=c/b;
  30. pot=pot*2;
  31. if((c%b)/a>0) {
  32. pot+=(c%b)/a;
  33. }
  34. else {
  35. pot--;
  36. }
  37. out=pot;
  38. if(c>=2*a) {
  39. pot=(c-2*a)/b*2+2;
  40. out=max(out,pot);
  41. }
  42. }
  43. if(c<a&&c<b) {
  44. out=0;
  45. }
  46. cout<<out<<endl;
  47. }
  48. }
Time limit exceeded #stdin #stdout 5s 5392KB
stdin
Standard input is empty
stdout
Standard output is empty