记录编号 85169 评测结果 AAAAAAAAAA
题目名称 [UVa 11462] 年龄排序 最终得分 100
用户昵称 Gravatar雪狼 是否通过 通过
代码语言 C++ 运行时间 1.657 s
提交时间 2013-12-28 09:41:04 内存使用 0.31 MiB
显示代码纯文本
  1. #include<iostream>
  2. #include<cmath>
  3. #include<cstring>
  4. #include<cstdio>
  5. #include<cstdlib>
  6. #define REP(i,a,b) for(int i=a;i!=b+1;++i)
  7. #define CLR(c,x) memset(c,x,sizeof(c));
  8. #define INF ~U0>>2
  9. #define eps 0.000002
  10. using namespace std;
  11.  
  12. typedef long long LL;
  13. long long num[121];
  14.  
  15. void setIO(string a){
  16. string in=a+".in",out=a+".out";
  17. freopen(in.c_str(),"r",stdin);
  18. freopen(out.c_str(),"w",stdout);
  19. }
  20.  
  21. int buf[10];
  22. inline void writeInt(int x){
  23. int p=0;
  24. if(x==0)p++;
  25. else while(x){
  26. buf[p++]=x%10;
  27. x/=10;
  28. }
  29. for(int i=p-1;i>=0;i--)putchar('0'+buf[i]);
  30. putchar(' ');
  31. return;
  32. }
  33.  
  34. void readInput(){
  35. CLR(num,0);int t;
  36. while(~scanf("%d",&t)){
  37. ++num[t];
  38. }
  39. }
  40.  
  41. void work(){
  42. REP(i,0,120)REP(j,1,num[i])writeInt(i);
  43. }
  44.  
  45. int main(){
  46. setIO("AgeSort");
  47. readInput();
  48. work();
  49. return 0;
  50. }