hiho week 143 register

Ended

Participants:1650

Verdict:Accepted
Score:100 / 100
Submitted:2017-04-01 14:34:58

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include <cstdlib>
#include <cstdio>
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    int *a = new int[n];
    for (int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    int label=0,max=a[n-1];
    for (int i=n-2;i>0;i--){
        if (a[i] > max){
            label=i;
            break;
        }
        else {
            max = a[i];
        }
    }
    for(int i=0;i<=label;i++){
        printf("%d ", a[i]);
    }
    system("pause");
    return 0;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX