patA1041 Be Unique

xiaoxiao2021-02-28  73

要按照输入的次序来,我们要对有序数字进行记录。

#include <iostream>

#include <cstdio> using namespace std; int hashT[10001]={0}; int record[100001]; int main(int argc, char** argv) { int n; scanf("%d",&n); for(int i=0;i<n;i++){ int num; scanf("%d",&num); record[i]=num; hashT[num]++; } int count=0; for(int i=0;i<n;i++){ if(hashT[record[i]]==1){ printf("%d",record[i]); count++; break; } } if(count==0) printf("None"); return 0; }
转载请注明原文地址: https://www.6miu.com/read-2600059.html

最新回复(0)