Robot

Problem Description
A robot is a mechanical or virtual artificial agent, usually an electro-mechanical machine that is guided by a computer program or electronic circuitry. Robots can be autonomous or semi-autonomous and range from humanoids such as Honda's Advanced Step in Innovative Mobility (ASIMO) and Tosy's TOSY Ping Pong Playing Robot (TOPIO) to industrial robots, collectively programmed 'swarm' robots, and even microscopic nano robots. By mimicking a lifelike appearance or automating movements, a robot may convey a sense of intelligence or thought of its own.
Robots have replaced humans in the assistance of performing those repetitive and dangerous tasks which humans prefer not to do, or are unable to do due to size limitations, or even those such as in outer space or at the bottom of the sea where humans could not survive the extreme environments.
After many years, robots have become very intellective and popular. Glad Corporation is a big company that produces service robots. In order to guarantee the safety of production, each robot has an unique number (each number is selected from 1 to N and will be recorded when the robot is produced).
But one day we found that N+1 robots have been produced in the range of 1 to N , that's to say one number has been used for 2 times. Now the president of Glad Corporation hopes to find the reused number as soon as possible.
 
Input
Multiple cases, end with EOF.
In each case, The first line has one number N, which represents the maximum number. The next line has N +1 numbers. (All numbers are between 1 to N, and only two of them are the same.) (1 <= N <= 103)
 
Output
Each case, output a line with the reused number.
There are no black lines between cases.
 
Sample Input
2
1 2 1
1
1 1
 
 
Sample Output
1
1

分析:直接统计每个数字出现的次数,为2的就输出就行了。

 #include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
const int maxn=;
int h[maxn];
int main()
{
int n;
while(scanf("%d",&n)!=EOF){
int a;
memset(h,,sizeof(h));
for(int i=;i<=n;i++){
scanf("%d",&a);
h[a]++;
if(h[a]==) printf("%d\n",a);
}
}
return ;
}

HDU-4593(水题)的更多相关文章

  1. HDU-1042-N!(Java大法好 &amp;&amp; HDU大数水题)

    N! Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Subm ...

  2. HDU 5391 水题。

    E - 5 Time Limit:1500MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Statu ...

  3. hdu 1544 水题

    水题 /* * Author : ben */ #include <cstdio> #include <cstdlib> #include <cstring> #i ...

  4. HDU排序水题

    1040水题; These days, I am thinking about a question, how can I get a problem as easy as A+B? It is fa ...

  5. hdu 2710 水题

    题意:判断一些数里有最大因子的数 水题,省赛即将临近,高效的代码风格需要养成,为了简化代码,以后可能会更多的使用宏定义,但是通常也只是快速拿下第一道水题,涨自信.大部分的代码还是普通的形式,实际上能简 ...

  6. Dijkstra算法---HDU 2544 水题(模板)

    /* 对于只会弗洛伊德的我,迪杰斯特拉有点不是很理解,后来发现这主要用于单源最短路,稍稍明白了点,不过还是很菜,这里只是用了邻接矩阵 套模板,对于邻接表暂时还,,,没做题,后续再更新.现将这题贴上,应 ...

  7. hdu 5162(水题)

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5162 题解:看了半天以为测试用例写错了.这题玩文字游戏.它问的是当前第i名是原数组中的第几个. #i ...

  8. hdu 3357 水题

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3357 #include <cstdio> #include <cmath> # ...

  9. hdu 5038 水题 可是题意坑

    http://acm.hdu.edu.cn/showproblem.php?pid=5038 就是求个众数  这个范围小 所以一个数组存是否存在的状态即可了 可是这句话真恶心  If not all ...

  10. hdu 5138(水题)

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5138 反着来. #include<iostream> #include<cstdi ...

随机推荐

  1. 【Xamarin挖墙脚系列:Xamarin开发环境配置需求】

    原文:[Xamarin挖墙脚系列:Xamarin开发环境配置需求] 前言 因为操作的全是大块头,加大你们的内存,CPU网上飙.... 卤煮的机器配置  最近的版本部署包,百度云离线下载:版本:Xama ...

  2. 【HDOJ】1969 Pie

    二分. #include <stdio.h> #include <math.h> ; ]; int main() { int case_n, n, f, m; double r ...

  3. 关于Session

    转自:http://blog.csdn.net/wang379275614/article/details/9627755 Session理解:   Session:在计算机中,尤其是在网络应用中,称 ...

  4. 再也不用担心ie下console.log报错了。。。

    习惯了在ff或者chrome下暴力调试的你会不会忘记注释掉而在ie下报错呢,那么可以加这个代码: if (typeof console == "undefined") { this ...

  5. 通过udl文件得到连接字符串

    1.新建一个文件,文件名任意,扩展名为udl 2.双击打开这个udl文件 3.点下一步: 4.测试连接成功后点击确定 5.用记事本打开这个udl文件: 连接字符串就出来了

  6. HDOJ/HDU 1241 Oil Deposits(经典DFS)

    Problem Description The GeoSurvComp geologic survey company is responsible for detecting underground ...

  7. JavaScript高级程序设计30.pdf

    第12章 DOM2和DOM3 DOM1级主要定义的是HTML和XML文档的底层结构.DOM2和DOM3则在这个结构的基础上引入了更多的交互能力,也支持更高级的XML特性 DOM2和DOM3级分为许多模 ...

  8. DAL与数据库类型的对应关系

    MSSQL Server类型 DbType类型 C#类型   MySql类型 DbType类型 C#类型 bit Boolean bool   bit(1) Boolean bool tinyint ...

  9. Opencl API解释(二)

    欢迎关注,转载引用请注明 http://blog.csdn.net/leonwei/article/details/8909897 这里将更深入的说明一些OpenCL API的功能 1. 创建buff ...

  10. android4.0 FaceDetection笔记

    这几天研究了下andoid4.0.3的FaceDetection这里写一下大致的流程,方便日后查阅. 相关说明可以在这里找到: frameworks/base/docs/html/guide/topi ...