fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main() {
  4. int t;
  5. cin>>t;
  6. for(int i=0;i<t;i++)
  7. {
  8. int x,y;
  9. cin>>x>>y;
  10. int p,q,r,s;
  11. p=500-(x*2);
  12. q=1000-((y+x)*4);
  13. r=1000-(y*4);
  14. s=500-((y+x)*2);
  15. int r1=p+q;
  16. int r2=r+s;
  17. int v=max(r1,r2);
  18. cout<<v<<"\n";
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0.01s 5520KB
stdin
4
10 20
8 40
15 15
20 10
stdout
1360
1292
1380
1400