#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. centos服务器全新安装php,apache环境

    留个备份,有空研究一下. 1 yum install php56w-devel.x86_64 yum install httpd-devel.x86_64 vim /etc/php.ini vim / ...

  2. Net分布式系统之三:Keepalived+LVS+Nginx负载均衡之高可用

    上一篇写了nginx负载均衡,此篇实现高可用(HA).系统整体设计是采用Nginx做负载均衡,若出现Nginx单机故障,则导致整个系统无法正常运行.针对系统架构设计的高可用要求,我们需要解决Nginx ...

  3. sql遍历

    DECLARE @BTime DATETIME,@ETime DATETIME;DECLARE @Temp TABLE (ID BIGINT IDENTITY(1,1),aid BIGINT,newc ...

  4. HTTP Error 503. The service is unavailable

    网站运行一段时间后,突然所有的页面都报告以下错误: HTTP Error 503. The service is unavailable 经检查,应用程序池自动停止,可能是工作进程抛出的异常数超出限制 ...

  5. SQL SERVER 分页查询

    Sqlserver数据库分页查询一直是Sqlserver的短板. 但现在不是了. 自从有了它. 一口气上十楼. 官方语法说明示例: https://technet.microsoft.com/zh-c ...

  6. 放假回来啦!!小技能:一个div不给width,怎么让它居中捏?`(*∩_∩*)′

    答案是:这个div没有浮动的话,就用text-align: center; 有的话...我也不知道了

  7. 最近自己封装了个JS脚本,用来创建和操作Table

    基于JQuery封装的Table操作脚本 /** 依赖JQuery **/ (function () { var Table = window.Table = function (rowCount, ...

  8. hashMap的数据结构

    HashMap底层实现还是数组,只是数组的每一项都是一条链.

  9. Ajax调用SpringMVC ModelAndView 无返回情况

    在项目中使用Ajax的时候,success中返回的data一直都是null,也没有报错.在确定Ajax语法没有错误,也没有牵扯跨域问题后,用排除法挨着删除代码,发现是因为Spring MVC会自动把方 ...

  10. C#获取程序集自动增加的版本号和编译时间

    1. 首先找到文件AssemblyInfo.cs, 路径如下: 2. 修改版本的格式,修改后,程序每次编译,程序集的版本号都会自增. 修改前: [assembly: AssemblyVersion(& ...