hiho week 143 register

Ended

Participants:1650

Verdict:Accepted
Score:100 / 100
Submitted:2017-03-31 18:26:49

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include<cstdio>
#include<cstdlib>
int a[2000];
int main()
{
    int n;
    scanf("%d",&n);
    for (int i=0;i<n;i++) scanf("%d",&a[i]);
    if (n==1) {printf("1\n"); return 0;}
    int j;
    j=n-2;
    while (j>0&&a[j]<a[j+1]) j--;
    for (int i=0;i<j+1;i++)
        printf("%d ",a[i]);
    printf("\n");
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX