CSP题解|201412-1 门禁系统|100分
#include <bits/stdc++.h> using namespace std; int main() { int n;cin>>n; map<int,int>mp; while(n--){ int temp;cin>>temp; if(mp.find(temp) == mp.end()){ cout<<1<<" "; mp[temp]=1; }else cout<<++mp[temp]<<" "; } }
#include <bits/stdc++.h> using namespace std; int main() { int n;cin>>n; map<int,int>mp; while(n--){ int temp;cin>>temp; if(mp.find(temp) == mp.end()){ cout<<1<<" "; mp[temp]=1; }else cout<<++mp[temp]<<" "; } }
相关推荐