Codeforces 4C (STL map)

来源:互联网 发布:python 2 3区别 编辑:程序博客网 时间:2024/05/29 11:23

http://codeforces.com/problemset/problem/4/C

水题,用STL map秒杀……

AC代码(C++11):

#include <iostream>#include <unordered_map>#include <string>/*Problem: Registration systemSource: Codeforces 4CAuthor: fts2001*/using namespace std;unordered_map<string,int> mp;int n;int main(){ios::sync_with_stdio(false);cin>>n;while(n--){string s;cin>>s;if(!mp[s])cout<<"OK\n";else cout<<s<<mp[s]<<endl;mp[s]++;}return 0;}


0 0
原创粉丝点击