比赛 noip2016普及练习2 评测结果 AAAAAAAAAA
题目名称 排序测试 最终得分 100
用户昵称 蜗牛哲 运行时间 7.492 s
代码语言 C++ 内存使用 7.94 MiB
提交时间 2016-11-07 19:48:05
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
#include<cstdlib>
#include<ctime>
#include<cctype>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<string>
#include<sstream>
#include<iomanip>
using namespace std;
//=====================struct declaration======================

//=====================var declarartion========================
const int maxn=2000000+10;
int a[maxn];

int n;
//=====================function declaration====================
int getint();
//=====================main code===============================
int main()
{
	freopen("sorttest.in","r",stdin);
	freopen("sorttest.out","w",stdout);
	
	n=getint();
	for(int i=0; i<n; i++)
	{
		a[i]=getint();
	}
	
	sort(a,a+n);
	
	for(int i=0; i<n-1; i++)
	{
		printf("%d ",a[i]);
	}
	printf("%d\n",a[n-1]);
	
	return 0;
}
//=====================function code===========================
int getint()
{
	int x=0,s=1;
	char ch=' ';
	while(ch<'0' || ch>'9')
	{
		ch=getchar();
		if(ch=='-') s=-1;
	}
	while(ch>='0' && ch<='9')
	{
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*s;
}