51Nod--1018排序
第1行:整数的数量N(1 <= N <= 50000)
第2 - N + 1行:待排序的整数(-10^9 <= A[i] <= 10^9)
共n行,按照递增序输出排序好的数据。
5
5
4
3
2
1
1
2
3
4
5
源代码:
<span style="font-size:18px;">#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<deque>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<iomanip>
#include<cstdlib>
#include<cmath>
#include<sstream>
#include<ctime>
using namespace std; int ans[50005]; int cmp(const int &a,const int &b)
{
return a < b;
} int main()
{
int n;
int i;
scanf("%d",&n);
for(i = 0; i < n; i++)
scanf("%d",&ans[i]);
//sort(ans,ans+n);//默认从小到大
sort(ans,ans+n,cmp);
for(i = 0; i < n; i++)
printf("%d\n",ans[i]);
return 0;
}
</span>
51Nod--1018排序的更多相关文章
- 51nod 1018 排序
1018 排序 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注 给出N个整数,对着N个整数进行排序 Input 第1行:整数的数量N(1 <= N ...
- (快排)51NOD 1018 排序
给出N个整数,对着N个整数进行排序 Input 第1行:整数的数量N(1 <= N <= 50000) 第2 - N + 1行:待排序的整数(-10^9 <= A[i] < ...
- 51Nod 2020 排序相减
题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=2020 思路:排序 水水 #include<iostre ...
- 【51NOD-0】1018 排序
[算法]排序 #include<cstdio> #include<algorithm> using namespace std; ]; int main() { scanf(& ...
- 51nod 2020 排序相减(暴力解法)
题目: 代码: #include <bits\stdc++.h> using namespace std; int trim(int x){ ]; ;i < ; i++){ a[i] ...
- 51nod 1589 移数博弈【桶排序+链表】
1589 移数博弈 基准时间限制:1 秒 空间限制:262144 KB 分值: 80 难度:5级算法题 小A和小B在玩一个游戏. 他们拥有一个数列. 小A在该数列中选择出最大的那个数,然后移出该数 ...
- 51nod 1095 Anigram单词【hash/map/排序/字典树】
1095 Anigram单词 基准时间限制:1 秒 空间限制:131072 KB 分值: 10 难度:2级算法题 收藏 关注 一个单词a如果通过交换单词中字母的顺序可以得到另外的单词b,那么定义b ...
- 51nod 1874 字符串排序
1874 字符串排序 基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题 收藏 关注 定义一个字符串的无序度为所有位置后面的字母比该位置的字母小的总数之和.比如&q ...
- 51nod 1402 最大值 3级算法题 排序后修改限制点 时间复杂度O(m^2)
代码: 题意,第一个数为0,相邻的数相差0或者1,有一些点有限制,不大于给定值,求这组数中可能的最大的那个数. 这题我们看一个例子:第5个数的限制为2 1 2 3 4 5 6 7 8 9 0 1 2 ...
随机推荐
- inline的C99标准相关原文
WG14/N1256 Annex J (informative) Portability issues J.1 Unspecified behavior Whether a call to an in ...
- 2017上海QCon之旅总结(中)
本来这个公众号的交流消息中间件相关的技术的.上周去上海参加了QCon,第一次参加这样的技术会议,感受挺多的,所以整理一下自己的一些想法接公众号和大家交流一下. 三天的内容还挺多的,原计划分上下两篇总结 ...
- 编程&blog处女篇-用C#求100以内的质数
using System;namespace Loops{ class Program { static void Main(string[] args) { /*局部变量定义*/ int i, j; ...
- angular高级篇之transclude使用详解
angular指令的transclude属性是一个让初学者比较难以理解的地方,transclude可以设置为false(默认),true或者对象三种值,如果不设该属性就默认为false,也就是说你不需 ...
- 微信公众号开发(十二)OAuth2.0网页授权
OAuth允许用户提供一个令牌,而不是用户名和密码来访问它们存放在特定服务器上的数据,每一个令牌授权一个特定的网站在特定时段内访问特定的资源. 授权过程如下: 1.引导用户进入授权页面同意授权,获取c ...
- 采访 Lua 发明人的一篇文章
采访 Lua 发明人的一篇文章 来源 https://blog.codingnow.com/2010/06/masterminds_of_programming_7_lua.html <Mast ...
- Toxophily
Problem Description The recreation center of WHU ACM Team has indoor billiards, Ping Pang, chess and ...
- 0_Simple__cudaOpenMP
在OpenMP的多线程程序中,各线程分别调用CUDA进行计算.OpenMP的简单示例. ▶ 源代码: #include <omp.h> #include <stdio.h> # ...
- python3.0 模拟用户登录,三次错误锁定
# -*- coding:utf-8 -*- #需求模拟用户登录,超过三次错误锁定不允许登陆 count = 0 #realname passwd Real_Username = &quo ...
- PaaS 调研:GAE与 AWS(上)
欢迎大家前往腾讯云社区,获取更多腾讯海量技术实践干货哦~ 作者:韩伟 起因 PaaS作为"云"的概念,已经流行了很久.从使用的角度上看,似乎就是:写一个PHP,然后可以直接传到服务 ...