http://codeforces.com/contest/27

A

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 #define lson l,mid,rt<<1
 4 #define rson mid+1,r,rt<<1|1
 5 #define sqr(x) ((x)*(x))
 6 #define maxn 1000005
 7 typedef long long ll;
 8 typedef unsigned long long ull;
 9 const ull MOD=257;
10 /*#ifndef ONLINE_JUDGE
11         freopen("1.txt","r",stdin);
12 #endif */
13 
14 int a[3005];
15 
16 int main(){
17     #ifndef ONLINE_JUDGE
18      //   freopen("1.txt","r",stdin);
19     #endif
20     std::ios::sync_with_stdio(false);
21     int n;
22     cin>>n;
23     for(int i=1;i<=n;i++){
24         cin>>a[i];
25     }
26     sort(a+1,a+n+1);
27     int i;
28     for(i=1;i<=n;i++){
29         if(a[i]!=i){
30             cout<<i<<endl;
31             break;
32         }
33     }
34     if(i==n+1) cout<<n+1<<endl;
35 }
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-02
  • 2021-06-25
  • 2022-12-23
相关资源
相似解决方案