#include<iostream>
#include<cmath>
#include<iomanip>
#include<algorithm>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        int a[n];
        for(int i =0 ;i<n;i++){
            int c;
            cin>>c;
            a[i] = c;
        }
        for(int i=0;i<n;i++){
            for(int j=i;j<n;j++){
                int tem;
                if(a[i]>a[j]){
                   tem = a[j];
                   a[j]=a[i];
                   a[i]=tem;
                }
            }
        }
       for(int i =0 ;i<n;i++){
           cout<<a[i]<<endl;
       }   
   
    }

return 0;
}

#include<iostream>
#include<cmath>
#include<iomanip>
#include<algorithm>
using namespace std;
int main(){
 int t;
 cin>>t;
 while(t--){
  int n;
  cin>>n;
  int a[n];
     for(int i =0 ;i<n;i++){
   int c;
   cin>>c;
   a[i] = c;
  }
  sort( a,a+n, less<int>() );
  for(int i=0;i<n;i++){
          cout<<a[i]<<endl;
      } 
 
 }
 return 0;
}

1154. Easy sort的更多相关文章

  1. sicily 1154. Easy sort (tree sort& merge sort)

    Description You know sorting is very important. And this easy problem is: Given you an array with N ...

  2. [SOJ]Easy sort (归并排序)

    Description You know sorting is very important. And this easy problem is: Given you an array with N ...

  3. Sort Methods

    heyheyhey ~~ It has been a long time since i come here again...whatever today i will summerize some ...

  4. uva--11991 - Easy Problem from Rujia Liu?(sort+二分 map+vector vector)

    11991 - Easy Problem from Rujia Liu? Though Rujia Liu usually sets hard problems for contests (for e ...

  5. Codeforces Round #650 (Div. 3) F1. Flying Sort (Easy Version) (离散化,贪心)

    题意:有一组数,每次操作可以将某个数移到头部或者尾部,问最少操作多少次使得这组数非递减. 题解:先离散化将每个数映射为排序后所对应的位置,然后贪心,求最长连续子序列的长度,那么最少的操作次数一定为\( ...

  6. [leetcode] 905. Sort Array By Parity [easy]

    原题链接 很水的一道题,就是数组内部交换. 水题就想着减少复杂度嘛,于是学到一种交换写法. class Solution { public: vector<int> sortArrayBy ...

  7. 九度 题目1154:Jungle Roads

    题目描写叙述: The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid mon ...

  8. Sort with Swap(0, i)

    原题连接:https://pta.patest.cn/pta/test/16/exam/4/question/678 题目如下: Given any permutation of the number ...

  9. PAT 1067. Sort with Swap(0,*)

    1067. Sort with Swap(0,*) (25)   Given any permutation of the numbers {0, 1, 2,..., N-1}, it is easy ...

随机推荐

  1. SQL ROW_NUMBER()实现取组内最新(最大)的数据

    SELECT * FROM(select ROW_NUMBER() over(partition BY sid order by cscore desc) as tid,sid,cname,cscor ...

  2. ios 中 documents和library 的区别

    简单来说就是用户在APP中输入并保存的数据放在Documents文件夹中(如用户输入的文本等), 并且如果手机连接电脑时,iTunes会自动备份其中文件,苹果不允许我们将下载的大型文件放入该文件夹. ...

  3. MIME Type

    一.首先,我们要了解浏览器是如何处理内容的.在浏览器中显示的内容有 HTML.有 XML.有 GIF.还有 Flash --那么,浏览器是如何区分它们,决定什么内容用什么形式来显示呢?答案是 MIME ...

  4. ubuntu 16 mysql安装包安装 (推荐在线安装)

    /etc/init.d/中的文件命名为mysql cp好各种文件后 ./mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/my ...

  5. jq 和 原生js进行传输文件ajax请求

    <body> <input id="file_upload" name="file_upload" type="file" ...

  6. xml/map转换器,递归设计思路

    xml/map转换器 图片:http://pan.baidu.com/s/1nuKJD13 应用场景,为什么要把xml转map?我直接用jdom,dom4j操作不行吗? 如果你了解模板引擎(像velo ...

  7. Web应用定时任务实现

    一.需求: 项目上有时需要执行一些定时任务,比如:超过2天未处理的问题,邮件自动通知客服.对接人:3天未处理的问题,邮件自动通知客服.对接人和项目经理,同时标为‘紧急’状态:5天未处理的问题,邮件自动 ...

  8. Web UI自动化测试中绕开验证码登陆方式浅谈

    web自动化测试中让测试者感到困惑的是登陆验证码,每次都不一样.现在推荐一种绕开验证码登陆的方式,其实就是将web浏览器获取的登陆cookie加载到程序中就可以了,这样程序就会认为你已经登陆,就可以跳 ...

  9. python实验一:画图

    题目:画图,学用rectangle画方形. rectangle(int left, int top, int right, int bottom) 参数说明:(left ,top )为矩形的左上坐标, ...

  10. bc:linux下命令行计算器

    在linux下,存在一个命令行的计算器:bc.该程序一般随发行版发布. bc计算器能够执行一些基本的计算,包括+,-,×,\,%. 这些计算不经针对十进制,还可以使用二进制,八进制,十六进制,并且可以 ...