hiho week 276 register

Ended

Participants:40

Verdict:Accepted
Score:100 / 100
Submitted:2019-10-16 20:54:47

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>
#define N 100005
int a[N];
int main(){
    int n;
    scanf("%d", &n);
    for(int i=1; i<=n; ++i)
        scanf("%d", &a[i]);
    int k = n;
    for(int i=n; i>0; --i){
        if(a[i] == k) --k;
    }
    printf("%d", k);
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX