fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. //#define int long long int
  4.  
  5. int cpoints(int a,int x,int b,int y,int c,int z)
  6. {
  7. int timeg=240;
  8. int qs=20,qg=a,pg=x;
  9. int points=0;
  10. for(int i=0;i<3;i++)
  11. {
  12. if(i==1)
  13. { qg=b;
  14. pg=y;}
  15. if(i==2)
  16. {qg=c;
  17. pg=z;}
  18. if(!(qs*qg<=timeg))
  19. {
  20. while(!(qs*qg<=timeg)&&qs>=0)
  21. qs--;
  22. }
  23. points+=qs*pg;
  24. timeg-=qs*qg;
  25. qs=20;}
  26. return points;
  27.  
  28.  
  29. }
  30. int main() {
  31. // your code goes here
  32.  
  33. int t;
  34. cin>>t;
  35. while(t--)
  36. {
  37. int a,b,c,x,y,z;
  38. cin>>a>>b>>c>>x>>y>>z;
  39.  
  40. int ar[6];
  41. ar[0]=cpoints(a,x,b,y,c,z);
  42. ar[1]=cpoints(a,x,c,z,b,y);
  43. ar[2]=cpoints(c,z,a,x,b,y);
  44. ar[3]=cpoints(b,y,a,x,c,z);
  45. ar[4]=cpoints(b,y,c,z,a,x);
  46. ar[5]=cpoints(c,z,b,y,a,x);
  47. int maxim=ar[0];
  48. for(int i=1;i<6;i++)
  49. {
  50. maxim=max(maxim,ar[i]);
  51. }
  52. cout<<maxim<<endl;
  53. }
  54.  
  55. return 0;
  56. }
  57.  
Success #stdin #stdout 0s 5372KB
stdin
3
4 4 4
5 5 5
5 5 5
10 8 6
5 6 7
5 6 7
stdout
300
408
240