PAT(甲级)1041
来源:互联网 发布:网络覆盖解决方案 编辑:程序博客网 时间:2024/06/05 18:37
1041. Be Unique (20)
时间限制
100 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue
Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1, 104]. The first one who bets on a unique number wins. For example, if there are 7 people betting on 5 31 5 88 67 88 17, then the second one who bets on 31 wins.
Input Specification:
Each input file contains one test case. Each case contains a line which begins with a positive integer N (<=105) and then followed by N bets. The numbers are separated by a space.
Output Specification:
For each test case, print the winning number in a line. If there is no winner, print "None" instead.
Sample Input 1:7 5 31 5 88 67 88 17Sample Output 1:
31Sample Input 2:
5 888 666 666 888 888Sample Output 2:
None
#include <cstdio>#include <cstring>#define SIZE 100005int record[SIZE];int input[SIZE];int main(){int N,tmp;scanf("%d",&N);memset(record,0,sizeof(int)*SIZE);int i,j;for(i=0;i<N;i++){scanf("%d",&tmp);input[i] = tmp;record[tmp]++;}for(i=0;i<N;i++){j=input[i];if(record[j] ==1){printf("%d\n",j);return 0;}}printf("None\n");return 0;}
0 0
- PAT(甲级)1041
- 浙大PAT甲级 1041
- PAT甲级1041
- PAT甲级 1041
- PAT 甲级
- PAT 甲级 1041 Linked List Sorting (25)
- PAT甲级 A1025.PAT RANKING
- PAT 甲级 1025 PAT Ranking
- PAT(甲级)1003
- PAT(甲级)1004
- PAT(甲级)1005
- PAT(甲级)1006
- PAT(甲级)1007
- PAT(甲级)1008
- PAT(甲级)1009
- PAT(甲级)1010
- PAT(甲级)1011
- PAT(甲级)1012
- 如何完善链接
- PAT(甲级)1040
- C#学习笔记(五)
- Java求二叉树的最大路径和
- HDU 4554 叛逆的小明(西山居挑战赛)
- PAT(甲级)1041
- test7.21
- Struts2标签之bean
- 网上看了篇文章关于多表连接的,感觉很好,记录下来,以便日后自己学习
- HDU - 1069 Monkey and Banana(DAG)
- Android面试题
- PAT(甲级)1042
- Delphi XE7-Windows下配置开发环境(Android版)
- 机房收费系统用户手册