hiho week 143 register

Ended

Participants:1650

Verdict:Accepted
Score:100 / 100
Submitted:2017-03-26 09:11:52

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 <string>
#include <cstring>
#include <fstream>
#include <functional>
#include <algorithm>
#include <ctime>
#include <cmath>
using namespace std;
int data[1010], N;
int main(){
    ifstream in("C:\\input.txt");
    cin >> N;
    for (int i = 1; i <= N; ++i)
        cin >> data[i];
    if (N == 1){
        cout << data[1] << endl;
    }
    else{
        int pos = N;
        while (pos > 2 && data[pos] > data[pos - 1])
            pos--;
        for (int i = 1; i < pos; ++i)
            cout << data[i] << " ";
        cout << endl;
    }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX