FZU 1001 Duplicate Pair
来源:互联网 发布:聚宝盆时时彩软件 编辑:程序博客网 时间:2024/04/27 15:51
Description
An array of length n, with address from 1 to n inclusive, contains entries from the set {1,2,...,n-1} and there's exactly two elements with the same value. Your task is to find out the value.
Input
Input contains several cases.
Each case includes a number n (1<n<=10^6), which is followed by n integers.
The input is ended up with the end of file.
Each case includes a number n (1<n<=10^6), which is followed by n integers.
The input is ended up with the end of file.
Output
Your must output the value for each case, one per line.
Sample Input
2
1 1
4
1 2 3 2
Sample Output
12
简单题
#include<stack>#include<queue>#include<cmath>#include<cstdio>#include<vector>#include<string>#include<cstdlib>#include<cstring>#include<algorithm>using namespace std;typedef long long LL;const int maxn=1000005;int T,n,m,f[maxn];int main(){while (~scanf("%d",&n)){for (int i=1;i<n;i++) f[i]=0;for (int i=1;i<=n;i++){scanf("%d",&m);f[m]++;if (f[m]==2) printf("%d\n",m);}}return 0;}
0 0
- FZU 1001 Duplicate Pair
- fzu 1001 Duplicate Pair
- FZU 1001 Duplicate Pair
- FZU 1001 Duplicate Pair(简单题目)
- Problem 1001 Duplicate Pair
- FOJ-1001-Duplicate Pair
- Problem 1001 Duplicate Pair
- Problem 1001Duplicate Pair
- Duplicate Pair
- Duplicate Pair
- FOJ 1001 Duplicate Pair (位图算法)
- Duplicate Pair(异或操作)
- FZU 1001
- pair
- pair
- Pair
- Pair
- pair
- XAMPP启动Apache:Port 443 in use by VMware-hosted.exe
- Twitter Streaming API的调用
- In Touch (hdu 5361 优先队列的Dij + 并查集优化)
- 武汉九通远大机械设备有限公司非骗子时光不荒芜1
- MongoDB基本文件操作
- FZU 1001 Duplicate Pair
- oracle的字符类型varchar2为什么要加上2呢?
- HDU 5358 First One
- UVA 10892 LCM Cardinality (分解因数+暴力)
- CasperJS 实现百度登录
- 夜间模式
- IVRE扫描并导入数据
- 横向看分类,扩展,协议的区别
- 为什么选择计算机专业?