#F0080. 判断升序
判断升序
题目描述
实现public static boolean isSorted(int[] table)
判断整数数组元素是否已经按升序排序。
输入格式
一列数,需要判断的数组元素。
输出格式
如果已经排序输出YES
如果没有排序输出NO
样例 1
输入
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())
????????????????????????
}
}
题目来源:数据结构Java版;FPS 共享题包,题包内第 3 题。保留原作者与原赛事署名。