CodeForces 682B Alyona and Mex (题意水题)
and Codeforces 水题
2023-09-11 14:17:19 时间
题意:给定一个序列,你可以对这里面的数用小于它的数来代替,最后让你求,改完后的最大的序列中缺少的最小的数。
析:这个题,读了两个多小时也没读懂,要是读懂了,肯定能做出来。。。没什么可说的,就是尽量凑1 2 3 4 5。。。如果没有了,就输出。
代码如下:
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; int a[maxn]; int main(){ int n; while(cin >> n){ for(int i = 0; i < n; ++i) scanf("%d", &a[i]); sort(a, a+n); int cnt = 1; for(int i = 0; i < n; ++i) if(a[i] >= cnt) ++cnt; printf("%d\n", cnt); } return 0; }
相关文章
- What is the difference between Pipeline and Release Pipeline in azure devops?
- Git Bash and Pageant are not using keys
- 【LightOJ1282】Leading and Trailing(数论)
- 基本3D变换之World Transform, View Transform and Projection Transform
- Host key for * has changed and you have requested strict checking.Host key verification failed.
- codeforces 553 A Kyoya and Colored Balls
- Android Api Component---翻译任务和回退栈(Tasks and Back Stack)
- LightOJ 1348 Aladdin and the Return Journey
- CodeForces 400A Inna and Choose Options
- CodeForces 362E Petya and Pipes
- CodeForces 400D Dima and Bacteria (并查集+Floyd)
- CodeForces 719B Anatoly and Cockroaches (水题贪心)
- CodeForces 288C Polo the Penguin and XOR operation (位运算,异或)
- CodeForces 289A Polo the Penguin and Segments (水题)
- CodeForces 342C Cupboard and Balloons (几何问题)
- CodeForces 518A Vitaly and Strings (水题,字符串)
- JMeter学习-027-JMeter参数文件(脚本分发)路径问题:jmeter.threads.JMeterThread: Test failed! java.lang.IllegalArgumentException: File distributed.csv must exist and be readable解决方法
- 【CodeForces 557B】Pasha and Tea
- 【CodeForces 611C】New Year and Domino
- Atitit.可视化编程jbpm6 的环境and 使用总结...
- Codeforces 467C. George and Job
- Codeforces 385 D Bear and Floodlight
- Codeforces Round #160 (Div. 2)---A. Roma and Lucky Numbers
- Hough直线and圆环变换(如何检测直线、圆环)