hihoCoder太阁最新面经算法竞赛12 register

Ended

Participants:164

Verdict:Accepted
Score:100 / 100
Submitted:2016-10-25 01:03:10

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 input = new Scanner(System.in);
        int n = input.nextInt();
        int[] arr = new int[n];
        for(int i = 0i<n ;i++){
            arr[i= input.nextInt();
        }
        int left = 0;
        int right = n-1;
        
        while(left <right && arr[left<= arr[left+1]){
            left++;
        }
        if(left == right){
            System.out.println(0);
            return;
        }
        
        while(arr[right-1<= arr[right]){
            right--;
        }
        
        int min = 100000009;
        int max = -9;
        
        for(int i = left ; i<=right ; i++){
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX