hiho week 143 register

Ended

Participants:1650

Verdict:Accepted
Score:100 / 100
Submitted:2017-03-27 11:01:45

Lang:Java

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
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int n = sc.nextInt();
            int[] arr = new int[n];
            for(int i = 0;i < n;i++){
                arr[i= sc.nextInt();
            }
            test(arr,n);
        }
    }
    
    public static void test(int [] arr,int n){
        int end = arr[n-1];
        int end_point = n-1;
        for(int i = n-2;i>=0;i--){
            if(end > arr[i]){
                end = arr[i];
                end_point = i;
            }
            else{
                break;
            }
        }
        String s = "";
        for(int i = 0;i<end_point;i++){
            s += arr[i]+" ";
        }
        if(end_point == 0){
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX