FZU 1001 Duplicate Pair(简单题目)
来源:互联网 发布:002航母知乎 编辑:程序博客网 时间:2024/04/27 19:45
Problem 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
#include<cstdio>#include<algorithm>using namespace std;int a[1000005];int main(){ int n; while(~scanf("%d",&n)) { for(int i=0;i<n;i++) { scanf("%d",&a[i]); } sort(a,a+n); for(int i=0;i<n;i++) { if(a[i]==a[i+1]) { printf("%d\n",a[i]); break; } } } return 0;}
0 0
- FZU 1001 Duplicate Pair(简单题目)
- FZU 1001 Duplicate Pair
- fzu 1001 Duplicate Pair
- FZU 1001 Duplicate Pair
- FOJ 1001 Duplicate Pair (位图算法)
- Problem 1001 Duplicate Pair
- FOJ-1001-Duplicate Pair
- Problem 1001 Duplicate Pair
- Problem 1001Duplicate Pair
- FZU 1002 HangOver(简单题目)
- FZU 1056 扫雷游戏(简单题目)
- Duplicate Pair
- Duplicate Pair
- Duplicate Pair(异或操作)
- FZU 题目1901 Period II (KMP)
- FZU 2197 最小花费(思维题目)
- FZU 2193 So Hard (简单的思维题目)
- FZU 2205 据说题目很水(思维题目)
- BroadcastReceiver
- 第二个单片机程序
- RxJava ,OKhttp ,fastJson的合用的MVP框架
- 2016-
- Service
- FZU 1001 Duplicate Pair(简单题目)
- 从两个文件读数据,排序后输出到新文件
- webstorm支持ES6语法详解
- 定时器NSTimer的开启与关闭
- [2040 ]: 亲和数
- 内容提供者
- 二叉树先序,中序,后序遍历之间的相互求法
- 大型网站架构体系的演变
- 完全使用listview实现下拉回弹