比赛 2016-10-11 4 syz 评测结果 AAAAAAAAAA
题目名称 数字积木 最终得分 100
用户昵称 森林 运行时间 0.039 s
代码语言 C++ 内存使用 0.32 MiB
提交时间 2016-10-11 18:55:33
显示代码纯文本
  1. #include<iostream>
  2. #include<cstdio>
  3. #include<cstring>
  4. #include<algorithm>
  5. #include<string>
  6. #include<iomanip>
  7. using namespace std;
  8. template<typename T>inline void QR(T& x){
  9. char ch;bool f=0;
  10. while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
  11. if(ch=='-'){f=1;ch=getchar();}x=ch-48;
  12. while(ch=getchar(),ch>='0'&&ch<='9')x=x*10+ch-48;
  13. if(f)x=-x;
  14. }
  15. template<typename T>inline void QW(T x){
  16. char str[30];short cnt=0;
  17. if(x<0){putchar('-');x=-x;}
  18. while(str[+cnt]=x%10+48,x/=10);
  19. while(putchar(str[cnt]),--cnt);
  20. }
  21. const int maxn=1100;
  22. inline bool com(const string& a,const string& b){
  23. return a+b>b+a;
  24. }
  25. string str[maxn];
  26. int main(){
  27. #define submit
  28. #ifdef submit
  29. freopen("brick.in","r",stdin);
  30. freopen("brick.out","w",stdout);
  31. #endif
  32. int n;
  33. scanf("%d",&n);
  34. for(int i=1;i<=n;i++)cin>>str[i];
  35. sort(str+1,str+1+n,com);
  36. for(int i=1;i<=n;++i){
  37. cout<<str[i];
  38. }putchar(10);
  39. #ifdef submit
  40. fclose(stdin);
  41. fclose(stdout);
  42. #else
  43. system("pause");
  44. #endif
  45. return 0;
  46. }