PRoblem Link:http://139.129.36.234/problem.php?id=1275
52 5 1 2 40样例输出
1 2 2 4 5提示
来源
北邮机试真题
AC code:
#include<iostream>#include<algorithm>#include<stdio.h>#include<map>#include<math.h>#include<string.h>#include<queue>#include<vector>#include<set>#define LL long long#define exp 1e-9#define MAXN 1000010using namespace std;int age[2000010];int main(){// freopen("D://in.txt","r",stdin); int n,i; while(scanf("%d",&n)!=EOF) { if(n==0) break; for(i=0;i<n;i++) { scanf("%d",&age[i]); } sort(age,age+n); printf("%d",age[0]); for(i=1;i<n;i++) { printf(" %d",age[i]); } puts(""); } return 0;}
新闻热点
疑难解答