fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int T;
  6. cin>>T;
  7. while (T--){
  8. int X,Y;
  9. cin>>X>>Y;
  10. int a,b;
  11. int s;
  12. a=500-X*2;
  13. b=1000-(Y+X)*4;
  14. s=a+b;
  15. int s1;
  16. a=1000-Y*4;
  17. b=500-(Y+X)*2;
  18. s1=a+b;
  19. if(s>s1)
  20. {
  21. cout<<s<<endl;
  22. }
  23. else
  24. cout<<s1<<endl;
  25.  
  26. }
  27. return 0;
  28. }
Success #stdin #stdout 0.01s 5432KB
stdin
4
10 20
8 40
15 15
20 10
stdout
1360
1292
1380
1400