hdu-1040-As Easy As A+B

本文提供了一个简单的C++程序解决HDU-1040问题(As Easy As A+B)。该程序首先读取一组整数的数量,然后读取这些整数,并按升序排列打印出来。使用了标准的输入输出流、排序算法。

题目链接

 1 /*
 2     Name:hdu-1040-As Easy As A+B
 3     Copyright:
 4     Author:
 5     Date: 2018/4/25 10:40:48
 6     Description:water
 7 */
 8 #include <iostream>
 9 #include <cstdio>
10 #include <algorithm>
11 using namespace std;
12 int main()
13 {
14 //    freopen("in.txt", "r", stdin);
15     int n;
16     cin>>n;
17     int nums[1005];
18     while (n--) {
19         int t;
20         cin>>t;
21         for (int i=0; i<t; i++) {
22             scanf("%d", &nums[i]);
23         }
24         sort(nums, nums + t);
25         cout<<nums[0];
26         for (int i=1; i<t; i++) {
27             printf(" %d", nums[i]);
28         }
29         cout<<endl;
30     }
31     return 0;
32 }

 

转载于:https://www.cnblogs.com/evidd/p/8940779.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值