• 空格数组HDU1040 简单排序


    改章节朋友在深圳逛街的时候突然想到的...今天就有想写几篇关于空格数组的博客,所以回家到之后就奋笔疾书的写出来发表了

        

    As Easy As A+B

        Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
    Total Submission(s): 27999    Accepted Submission(s): 11906

        

    Problem Description

        

    These days, I am thinking about a question, how can I get a problem as easy as A+B? It is fairly difficulty to do such a thing. Of course, I got it after many waking nights.
    Give you some integers, your task is to sort these number ascending (升序).
    You should know how easy the problem is now!
    Good luck!

        

     

        

    Input

        

    Input contains multiple test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow. Each test case contains an integer N (1<=N<=1000 the number of integers to be sorted) and then N integers follow in the same line. 
    It is guarantied that all integers are in the range of 32-int.

        

     

        

    Output

        

    For each case, print the sorting result, and one line one case.
        每日一道理
    航行者把树比作指引方向的路灯,劳动者把树比作遮风挡雨的雨伞,诗人把树比作笔下的精灵,而我却要把树比作教师,它就是为我们遮风挡雨的伞,指明方向的路灯,打开知识殿堂的金钥匙。

        

     

        

    Sample Input
    2 3 2 1 3 9 1 4 7 2 5 8 3 6 9
     

        

    Sample Output
    1 2 3 1 2 3 4 5 6 7 8 9
     

        

    这个题就是简略的排序,先用Arrays停止升序,但是提交上去老是PE,细心看了看目题要求,应该是出输的数组最后一个素元面后应不该有空格,改了一下,过了。
    从这个题上,还是学到不少货色的。
    package lixiangmao;
    
    import java.io.BufferedInputStream;  
    import java.util.Arrays;  
    import java.util.Scanner;  
      
    public class paixu1{  
        	 public static void main(String[] args) {  
        	        Scanner console = new Scanner(new BufferedInputStream(System.in));  
        	        Integer[] a = new Integer[1001];  
        	        Integer t,n;  
        	        t = console.nextInt();  
        	        while(t-- > 0){  
        	            n = console.nextInt();  
        	            for(int i = 0; i < n; i++){  
        	                a[i] = console.nextInt();  
        	            }  
        	            Arrays.sort(a, 0, n);  
        	            System.out.print(a[0]);  
        	            for(int i = 1; i < n; i++){  
        	                System.out.print(" "+a[i]);  
        	            }  
        	            System.out.println();  
        	        }  
        	    }  
    }  

    文章结束给大家分享下程序员的一些笑话语录: 一个程序员对自己的未来很迷茫,于是去问上帝。
    "万能的上帝呀,请你告诉我,我的未来会怎样?"
    上帝说"我的孩子,你去问Lippman,他现在领导的程序员的队伍可能是地球上最大的"
    于是他去问Lippman。
    Lippman说"程序员的未来就是驾驭程序员"
    这个程序员对这个未来不满意,于是他又去问上帝。
    "万能的上帝呀,请你告诉我,我的未来会怎样?"
    上帝说"我的孩子,你去问Gates,他现在所拥有的财产可能是地球上最多的"
    于是他去问Gates。
    Gates说"程序员的未来就是榨取程序员"
    这个程序员对这个未来不满意,于是他又去问上帝。
    "万能的上帝呀,请你告诉我,我的未来会怎样?"
    上帝说"我的孩子,你去问侯捷,他写的计算机书的读者可能是地球上最多的"
    于是他去问侯捷。
    侯捷说"程序员的未来就是诱惑程序员"
    这个程序员对这个未来不满意,于是他又去问上帝。
    "万能的上帝呀,请你告诉我,我的未来会怎样?"
    上帝摇摇头"唉,我的孩子,你还是别当程序员了")

  • 相关阅读:
    ZOJ 3631 Watashi's BG(dp+dfs)
    hdu 1506 Largest Rectangle in a Histogram(单调栈)
    csu 1392 Number Trick (数论)
    ACM 奋斗的小蜗牛
    ACM 16进制的简单运算
    ACM 交换输出
    ACM Longest Repeated Sequence
    ACM Arithmetic Expression
    ACM 素数
    ACM 无线网络覆盖
  • 原文地址:https://www.cnblogs.com/xinyuyuanm/p/3063409.html
Copyright © 2020-2023  润新知