HDU 4593 Robot (水题)
题意:有 n 个数,其中有两个数中相同的,让你找出这个数。
析:太简单了么,只要用数组下标记一下这个数的数量即可。
代码如下:
#include <iostream>
#include <cstdio>
#include <cstring> using namespace std;
const int maxn = 1e3 + 5;
int a[maxn]; int main(){
int n;
while(cin >> n){
memset(a, 0, sizeof(a));
for(int i = 0; i <= n; ++i){
int x;
scanf("%d", &x);
++a[x];
}
for(int i = 1; i <= n; ++i)
if(a[i] == 2){
printf("%d\n", i);
break;
}
}
return 0;
}
HDU 4593 Robot (水题)的更多相关文章
- HDU 4593 H - Robot 水题
H - RobotTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.act ...
- hdu 4593 Robot
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4593 Robot Description A robot is a mechanical or vir ...
- hdu 5210 delete 水题
Delete Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5210 D ...
- hdu 1251 (Trie水题)
统计难题 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others)Total Submi ...
- hdu - 5007 Post Robot (水题)
http://acm.hdu.edu.cn/showproblem.php?pid=5007 #include<iostream> #include<stdio.h> #inc ...
- HDU 5703 Desert 水题 找规律
已知有n个单位的水,问有几种方式把这些水喝完,每天至少喝1个单位的水,而且每天喝的水的单位为整数.看上去挺复杂要跑循环,但其实上,列举几种情况之后就会发现是找规律的题了= =都是2的n-1次方,而且这 ...
- HDU 4493 Tutor 水题的收获。。
题目: http://acm.hdu.edu.cn/showproblem.php?pid=4493 题意我都不好意思说,就是求12个数的平均数... 但是之所以发博客,显然有值得发的... 这个题最 ...
- 2013-2014 ACM-ICPC, NEERC, Southern Subregional Contest Problem L. Stock Trading Robot 水题
Problem L. Stock Trading Robot 题目连接: http://www.codeforces.com/gym/100253 Description CyberTrader is ...
- hdu 4802 GPA 水题
GPA Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4802 Des ...
随机推荐
- codeforces 510 C Fox And Names【拓扑排序】
题意:给出n串名字,表示字典序从小到大,求符合这样的字符串排列的字典序 先挨个地遍历字符串,遇到不相同的时候,加边,记录相应的入度 然后就是bfs的过程,如果某一点没有被访问过,且入度为0,则把它加入 ...
- WinCE的开发流程
总的来说,WinCE的开发是分为: 一.硬件开发:硬件设计,Boot Loader开发,OAL开发,BSP开发二.操作系统开发:定制驱动,创建最小内核,定制操作系统组件,测试集成三.应用程序开发:开发 ...
- ApplicationContext.xml 的最终xml声明,包括注解 aop
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...
- php 使用phpmailer 发送邮件(附带中文乱码的解决方法)
下载phpmailer ,在程序里包含class.phpmailer.php 类 ,这里有中文乱码的解决方法 实例代码如下 <html> <head> <title&g ...
- C# Math.Round中国式的四舍五入法
double dou = 1.255; //这种是错误的 double dou_result = Math.Round(dou, 2); //结果: 1.25 dou_result = Math.Ro ...
- 【Android】不弹root请求框检测手机是否root
由于项目需要root安装软件,并且希望在合适的时候引导用户去开启root安装,故需要检测手机是否root. 最基本的判断如下,直接运行一个底层命令.(参考https://github.com/Trin ...
- [Everyday Mathematics]20150225
设 $f:\bbR\to\bbR$ 二次可微, 适合 $f(0)=0$. 试证: $$\bex \exists\ \xi\in\sex{-\frac{\pi}{2},\frac{\pi}{2}},\s ...
- boost的link 和 runtime-link,搭配shared 和 static
转自:http://blog.csdn.net/yasi_xi/article/details/8660549 link:生成动态链接库/静态链接库.生成动态链接库需使用shared方式,生成静态链接 ...
- ansible定时任务模块和用户组模块使用
接上篇,还是一些基础模块的使用,这里主要介绍的是系统模块的使用. 下面例子都进行过相关的实践,从而可以直接进行使用相关的命令. 3.用户模块的使用 用户模块主要用来管理用户账号和用户的属性(对远程主机 ...
- effective c++:virtual函数的替代方案
绝不重新定义继承来的缺省值 首先明确下,虚函数是动态绑定,缺省参数值是静态绑定 // a class for geometric shapes class Shape { public: enum S ...