zoukankan      html  css  js  c++  java
  • SDNU 1212.判断升序(水题)

    Description

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

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

    Input

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

    Output

    如果已经排序输出YES

    如果没有排序输出NO

    Sample Input

    1
    2
    3
    4
    5
    6
    

    Sample Output

    YES
    

    Hint

    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())
      ????????????????????????

      }

    }


    Source

    #include <cstdio>
    #include <iostream>
    #include <cmath>
    #include <string>
    #include <cstring>
    #include <algorithm>
    #include <queue>
    #include <vector>
    #include <map>
    using namespace std;
    #define ll long long
    
    int num[100000+8], x;
    bool flag = 1;
    
    int main()
    {
        while(~scanf("%d", &x))
        {
            int id = 0;
            num[id] = x;
            if(!id && num[id]<num[id-1])flag = 0;
            id++;
        }
        if(flag)printf("NO
    ");
        else printf("YES
    ");
        return 0;
    }
  • 相关阅读:
    Java 反射机制
    Hibernate学习
    js学习
    如何在jsp中引入bootstrap
    bootstrap学习一
    第二章、初级篇
    定风波
    Java反射机制
    数据库的优化方法
    MySQL常用的查询语句回顾
  • 原文地址:https://www.cnblogs.com/RootVount/p/10991376.html
Copyright © 2011-2022 走看看