map秒法
2024-08-17 12:37:03
发布于:云南
9阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int main(){
map<string,int> mp;
int n; cin >> n;
while(n--){
string x; cin >> x;
if(mp[x] == 0){
cout << x << endl;
mp[x]++;
}else{
mp[x]++;
cout << x << "(" << mp[x] - 1 << ")" << endl;
}
}
return 0;
}
全部评论 1
顺便说一下,这是AT原题,看这里here
2025-01-25 来自 湖北
0
有帮助,赞一个