fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int t;cin>>t;
  6. while(t--){
  7. int a,b;cin>>a>>b;
  8. int x=500-(a*2);
  9. int y=1000-((a+b)*4);
  10. int ans=x+y;
  11. int p=1000-(b*4);
  12. int q=500-((a+b)*2);
  13. int ans1=p+q;
  14. cout<<max(ans,ans1)<<endl;
  15. }
  16. return 0;
  17. }
Success #stdin #stdout 0.01s 5340KB
stdin
4
10 20
8 40
15 15
20 10
stdout
1360
1292
1380
1400