java求助
  • 板块P1420 最长连号
  • 楼主p6oy
  • 当前回复0
  • 已保存回复0
  • 发布时间2022/5/5 20:21
  • 上次更新2023/10/28 02:05:52
查看原帖
java求助
511331
p6oy楼主2022/5/5 20:21

##求助,例题答案是一样的,下载的答案也是一样的,但是全是wa

import java.sql.Struct;
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        int n;
        int[] a=new int[10000];
        int i, max = 0, now = 1;
        Scanner ipt = new Scanner(System.in);
        n = ipt.nextInt();
        for(i=0;i<n;i++){
            a[i] = ipt.nextInt();
        }
        for(i = 0;i<n-1;i++){
            if(a[i+1]>a[i]){
                now++;
                if(now>max){
                    max = now;
                }
            }
            else{
                now = 1;
            }
        }
        System.err.print(max);    
    }
}

2022/5/5 20:21
加载中...