Browse Source

最后的赢家,打擂台即可

爱玲姐姐 5 years ago
parent
commit
a2a76516f2
1 changed files with 20 additions and 0 deletions
  1. 20 0
      E.cpp

+ 20 - 0
E.cpp

@@ -0,0 +1,20 @@
+#include <bits/stdc++.h>
+using namespace std;
+int main(){
+    int n;
+    cin >> n;
+    int MAX = 0;
+    string MAXstr = "";
+    map<string, int>m;
+    for(int i = 1; i <= n; i++){
+        string s;
+        int x;
+        cin >> s >> x;
+        m[s] = m[s]+x;
+        if(m[s] > MAX){
+            MAX = m[s];
+            MAXstr = s;
+        }
+    }
+    cout << MAXstr << endl;
+}