Guest User

Untitled

a guest
Sep 26th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. ifstream fin("input.txt");
  6. ofstream fout("output.txt");
  7.  
  8. int n, p, g, x, z, k;
  9.  
  10. int v[101];
  11.  
  12. int main() {
  13. fin >> n;
  14. for(x=0; x<n; x++){
  15. fin >> p >> g;
  16. v[p]+=g;
  17. }
  18. for(x=0; x<=100; x++){
  19. if(v[x]>z){
  20. z=v[x];
  21. k=x;
  22. }
  23. }
  24. fout << k <<" "<< z;
  25. }
Add Comment
Please, Sign In to add comment