CodeForces - 682B 题意水题
2017-07-15 23:36
363 查看
Input
The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of elements in the Alyona's array.
The second line of the input contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the elements of the array.
Output
Print one positive integer — the maximum possible value of mex of the array after Alyona applies some (possibly none) operations.
求更改后数列中没有的最小整数,不知更改,只能求最大可能
构成1 2 3 4.。
对于5 6 7 1 2 3
#include "cstdio" #include "iostream" #include "string" #include "cstring" #include "cmath" #include "vector" #include "map" #include "algorithm" using namespace std; int a[100005]; int main() { int n; while(scanf("%d",&n)!=EOF) { for(int i=0;i<n;i++) { scanf("%d",&a[i]); } sort(a,a+n); int min1=0; for(int i=0;i<n;i++) if(a[i]>min1)//可改 ++min1;///最大可能+1 printf("%d\n",min1+1); } }
相关文章推荐
- CodeForces 518B Tanya and Postcard (题意,水题)
- CodeForces 518B Tanya and Postcard (题意,水题)
- Codeforces 723A The New Year: Meeting Friends(题意有偏差的水题)
- CodeForces 682B Alyona and Mex (题意水题)
- codeforces 689A A. Mike and Cellphone(水题)
- Codeforces 851A . Arpa and a research in Mexican wave 水题
- Codeforces 469A I Wanna Be the Guy(水题)
- CodeForces-761A-Dasha and Stairs [水题]
- Codeforces 727C 猜数组(水题)
- codeforces 732B Cormen — The Best Friend Of a Man (水题)
- CodeForces 444C. DZY Loves Physics(枚举+水题)
- Codeforces 631A Interview【模拟水题】
- Codeforces 868 B Race Against Time(水题)
- CodeForces 589A Email Aliases STL水题
- codeforces水题100道 第二题 Codeforces Beta Round #4 (Div. 2 Only) A. Watermelon (math)
- codeforces水题100道 第二十四题 Codeforces Beta Round #85 (Div. 2 Only) A. Petya and Strings (strings)
- Codeforces 712A Memory and Crow 水题
- CodeForces 631A Interview(水题)
- codeforces 746 B. Decoding【水题】
- Codeforces 385A Bear and Raspberry(水题)