fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main() {
  4. int tc;
  5. cin>>tc;
  6. while(tc--)
  7. {
  8. int x,y;
  9. cin>>x>>y;
  10. int a,b,c,d;
  11. a=500-(x*2);
  12. b=1000-((y+x)*4);
  13. c=1000-(y*4);
  14. d=500-((y+x)*2);
  15. int result1=a+b;
  16. int result2=c+d;
  17. int result=max(result1,result2);
  18. cout<<result<<"\n";
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0.01s 5492KB
stdin
4
10 20
8 40
15 15
20 10
stdout
1360
1292
1380
1400