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

寵の児 提交于 2020-01-07 16:55:30

 

 

#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;
} 
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!