当前位置:网站首页>-Chess game-

-Chess game-

2022-08-10 01:47:00 -JMY-

Title description

The two students played n games of chess (3<=n<=9, and n is an odd number), their entry numbers are 10 and 20, and each game has a student who wins (that is, there is no tie), which student finally wonvictory?

Enter

In line 1 there is an integer n, which represents the competitionnumber of times.

Line 2 has n integers (the nThe integer must be 10 or 20, representing the entry number of the winning student).

Output

Output the entry number of the winning classmate.

Sample input

510 10 20 10 20

Sample output

10

Reference code:

#include
using namespace std;
int n,a[15],t[25],maxn,k;
int main(){
scanf("%d",&n);
for(int i=0;i scanf("%d",a+i);
for(int i=0;i t[a[i]]++;
if(t[a[i]]>maxn){
maxn=t[a[i]];
k=a[i];
}
}
printf("%d",k);
return 0;
}

原网站

版权声明
本文为[-JMY-]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/222/202208092346036935.html