博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Ignatius and the Princess IV (水题)
阅读量:4633 次
发布时间:2019-06-09

本文共 1488 字,大约阅读时间需要 4 分钟。

"OK, you are not too bad, em... But you can never pass the next test." feng5166 says. 

"I will tell you an odd number N, and then N integers. There will be a special integer among them, you have to tell me which integer is the special one after I tell you all the integers." feng5166 says. 
"But what is the characteristic of the special integer?" Ignatius asks. 
"The integer will appear at least (N+1)/2 times. If you can't find the right integer, I will kill the Princess, and you will be my dinner, too. Hahahaha....." feng5166 says. 
Can you find the special integer for Ignatius? 

Input

The input contains several test cases. Each test case contains two lines. The first line consists of an odd integer N(1<=N<=999999) which indicate the number of the integers feng5166 will tell our hero. The second line contains the N integers. The input is terminated by the end of file. 

Output

For each test case, you have to output only one line which contains the special number you have found. 

Sample Input

51 3 2 3 3111 1 1 1 1 5 5 5 5 5 571 1 1 1 1 1 1

Sample Output

351

题解:刷访问量,此题太简单

代码:

#include
#include
#include
#include
using namespace std;int main(){ int n; int dp[100005]={0}; while(scanf("%d",&n)!=EOF) { memset(dp,0,sizeof(dp)); int flag=0; int k; for(int t=0;t
=(n+1)/2) { if(flag==0) printf("%d\n",k); flag=1; } } }}

 

转载于:https://www.cnblogs.com/Staceyacm/p/10781977.html

你可能感兴趣的文章
ubi实际使用
查看>>
curl命令使用
查看>>
PYTHON自动化Day12-unittest自动注册登录
查看>>
为 Asp.net 网站新增发送手机短信功能
查看>>
hdu 1002大数(Java)
查看>>
CSS3——对齐 组合选择符 伪类 伪元素 导航栏 下拉菜单
查看>>
NOIP2005普及组第4题 循环
查看>>
xbmc-12.0稳定版代码初探 (2) —— XBMC_HOME
查看>>
Java GC 日志详解
查看>>
MySQL主主配置说明
查看>>
[建议] GCC 新手入门【转】
查看>>
AC日记——[Hnoi2017]影魔 bzoj 4826
查看>>
Python:通过一个小案例深入理解IO多路复用
查看>>
自定义View圆
查看>>
min stack
查看>>
Golang的接口
查看>>
《Java虚拟机规范》阅读(三):Class文件格式
查看>>
django中间件
查看>>
Linux Exploit系列之三 Off-By-One 漏洞 (基于栈)
查看>>
27-THREE.JS 平面
查看>>