记录编号 424217 评测结果 AAAAAAAAAA
题目名称 [NOIP 2010冲刺十]数字积木 最终得分 100
用户昵称 GravatarHeHe 是否通过 通过
代码语言 C++ 运行时间 0.053 s
提交时间 2017-07-12 23:57:43 内存使用 0.32 MiB
显示代码纯文本
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <cstring>
  4. #include <string>
  5. #include <algorithm>
  6. using namespace std;
  7.  
  8. inline bool cmp(const string &a, const string &b);
  9.  
  10. string s[1010];
  11. int N;
  12.  
  13. int main() {
  14. #ifndef LOCAL
  15. freopen("brick.in", "r", stdin);
  16. freopen("brick.out", "w", stdout);
  17. #endif
  18. scanf("%d", &N);
  19. for(int i = 0; i < N; ++i) cin>>s[i];
  20.  
  21. sort(s, s + N, cmp);
  22.  
  23. for(int i = 0; i < N; ++i) cout<<s[i];
  24.  
  25. return 0;
  26. }
  27.  
  28. inline bool cmp(const string &a, const string &b) {
  29. return a + b > b + a;
  30. }