#include <iostream>
#include <string>
#include <string.h>
using namespace std;
int main() {
int num,i,tmp,m;
int a[1001] = { 0 };
string s1, s2;
cin >> num;
while (num--) {
cin >> s1 >> s2;
string s3;
for (i = 0; s1[i] != '-'; i++) {
s3 += s1[i];
}
a[atoi(s3.c_str())]+=atoi(s2.c_str());
}
tmp = 0;
for (i = 0; i < 1001; i++) {
if (a[i] > tmp) {
tmp = a[i];
m = i;
}
}
printf("%d %d", m, a[m]);
return 0;
}
PAT乙级1047---atoi(string.c_str())函数
最新推荐文章于 2024-08-15 05:02:54 发布