算法初步——哈希表A1041.Be Unique

#include <bits/stdc++.h>
#include<math.h>
#include <string>
using namespace std;
const int MAX_LEN = 10005;
int main(){
    int n;
    cin>>n;
    int temp[MAX_LEN];
    for(int i=0;i<MAX_LEN;++i){
        temp[i] = 0;
    }
    int result[n];
    for(int i=0;i<n;++i){
        //cin>>temp[i];
        int t;
        cin>>t;
        temp[t]++;
        result[i] = t;
    }
    int i;
    for(i =0;i<n;++i){
        if(temp[result[i]] == 1){
            cout<<result[i];
            break;
        }
    }
    if(i == n){
        cout<<"None";
    }
    system("pause");
    return 0;
} 
原文地址:https://www.cnblogs.com/JasonPeng1/p/12162305.html