1244: 判断升序

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:4 解决:4

题目描述

实现public static boolean isSorted(int[] table)

判断整数数组元素是否已经按升序排序。

输入

一列数,需要判断的数组元素。

输出

如果已经排序输出YES

如果没有排序输出NO

样例输入 复制

1
2
3
4
5
6

样例输出 复制

YES

提示

import java.util.*;

public class Main{

   public static void main(String args[]){

  Scanner cin = new Scanner(System.in);

  int a, b;
  b=-1;
  while (cin.hasNext()){

  a = cin.nextInt();

              if(??????????){
                ????????;
               ????????????????????;
              }
 ????????????;

                        }

 if(!cin.hasNext())
  ????????????????????????

  }

}


来源/分类