PAT 1041 Be Unique (20)

#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<queue>
#include<vector>
#include<cmath>
#include<iomanip>
#include<algorithm>
using namespace std;

const int SIZE = 100000+5;
int arrCount[SIZE];

int main()
{
	int N,i,x;
	vector<int> v;
	memset(arrCount,0,sizeof(arrCount));
//	cin>>N;
	scanf("%d",&N);
	for(i=0; i<N; i++)
	{
		scanf("%d",&x);
	//	cin>>x;
		arrCount[x]++;
		v.push_back(x);
	}
	for(i=0; i<v.size(); i++)
		if(arrCount[v[i]] == 1)
		{
			cout<<v[i]<<endl;
			break;
		}
	if(i == v.size())
		cout<<"None"<<endl;
	return 0;
}

  

posted @ 2012-12-15 15:36  Frank@609  Views(435)  Comments(0Edit  收藏  举报