PAT-A1041(C/C++代码解析)
作者:互联网
1041 Be Unique (20 分)
注:散列
#include <stdio.h>
#include <string.h>
int main ()
{
int n,flag=0;
scanf ("%d",&n);
int i,hash[100001]={0},bet[n];
for (i=0;i<n;i++)
{
scanf ("%d",&bet[i]);
hash[bet[i]]++;
}
for (i=0;i<n;i++)
{
if (hash[bet[i]]==1)
{
printf ("%d",bet[i]);
flag=1;
break;
}
}
if (flag==0)
printf ("None");
return 0;
}
标签:hash,A1041,int,scanf,C++,flag,printf,PAT,bet 来源: https://blog.csdn.net/weixin_45859485/article/details/120293020