PTA 7-13 统计工龄 (20 分)

#include 
using namespace std;
int main()
{
	#ifdef ONLINE_JUDGE
	#else
	freopen("in.txt", "r", stdin);
	#endif
	
	int N, key;
	cin >> N;
	map M;
	int i;
	for(i = 0; i < N; i++){
		cin >> key;
		M[key]++;
	}
	
	map::iterator it;
	for(it = M.begin(); it != M.end(); it++){
		cout << it->first << ":" << it->second << endl;
	}
	
	return 0;
} 

你可能感兴趣的:(PTA数据结构,PTA)