Being unique is, important to people on Mars, even their lottery is designed in a unique. 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 is 7 people betting on 5 to 5, then the second one who bets on wins.
Input Description:
Each input file contains the one test case. Each case contains a line which begins with a positive an integer n (<=105) and then followed by N bets. The numbers is separated by a space.
Output Description:
For each test case, print the winning number in a line. If There is no winner, print "None" instead.
Input Example:
7 5 31 5 88 67 88 17
Output Example:
31
#include <iostream>using namespace STD;intMain () {intNCin>> N;intar[10001] = {0};intbr[100001] = {1}; for(inti =1; i < N; i++) {Cin>> Br[i]; Ar[br[i]] + +; } for(inti =1; i < N; i++) {if(Ar[br[i]] = =1) {cout<< Br[i] << Endl;return 0; } }cout<<"None"<< Endl;return 0;}
[Programming Questions] Be Unique (Gambler betting problem)