fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define endl "\n"
  4. int main(){
  5. int t;
  6. cin>>t;
  7. while(t--){
  8. int a ,b ,c;
  9. cin>>a>>b>>c;
  10. int x ,y ,z;
  11. cin>>x>>y>>z;
  12. int ans = 0;
  13. for(int i = 1; i < 21; i++){
  14. for(int j = 1; j < 21; j++){
  15. for(int k = 1; k < 21; k++){
  16. if(i*a + j*b + k*c <= 240){
  17. int reward = x*i + y*j + z*k;
  18. ans = max(ans , reward);
  19. }
  20. }
  21. }
  22. }
  23. cout<<ans<<endl;
  24. }
  25. }
Success #stdin #stdout 0s 5572KB
stdin
3
4 4 4
5 5 5
5 5 5
10 8 6
5 6 7
5 6 7
stdout
300
408
240