杭电acm--1040
2015-10-13 19:38
369 查看
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.
[align=left]Output[/align]
For each case, print the sorting result, and one line one case.
then N integers follow in the same line.
It is guarantied that all integers are in the range of 32-int.
[align=left]Output[/align]
For each case, print the sorting result, and one line one case.
#include<stdio.h> #include<stdlib.h> #include<iostream> #include<cmath> #include<iomanip> //#define P 3.141592653 using namespace std; void main() { int n, T, t; int arr[1000]; cin >> T; while (T--) { cin >> n; for (int i = 0; i<n; i++) cin >> arr[i]; for (int i = 0; i<n; i++) { for (int j = i + 1; j<n; j++) { if (arr[i]>arr[j]) { t = arr[i]; arr[i] = arr[j]; arr[j] = t; } } } cout << arr[0]; for (int i = 1; i<n; i++) cout << " " << arr[i]; cout << endl; } system("pause"); }
相关文章推荐
- tomcat Manger App
- struts2拦截器问题
- 【C++】指针&引用的区别
- Xsollad电竞学院为学生和教练打开大门啦!
- 【LeetCode】Binary Tree Level Order Traversal 解题报告
- ServletContext保存访问量
- Oracle-PlSQL程序设计
- iOS多线程编码之NSThread的使用
- Unity接口函数Vector3.Project()
- OpenCV - imwrite函数的使用
- Maven编译时跳过Test
- IOS之swift第一课基础代码
- Use of UUID(Universally unique identifier) in Ruby On Rails Application.
- hdu5269 ZYB loves Xor I
- photon mapping学习笔记
- php-----1 html简单介绍
- CodeForces 429B Working out(dp,四个角递推)
- UVA307把n个剪断的木棍还原,暴搜
- 表格变色(单击行,把当行的单选按钮(radio)设为选中状态,并应用当前样式)
- vim树形目录