比赛 防止浮躁的小练习v0.3 评测结果 AWAWAWWWWA
题目名称 数字积木 最终得分 40
用户昵称 asddddd 运行时间 0.058 s
代码语言 C++ 内存使用 1.09 MiB
提交时间 2016-10-12 17:34:27
显示代码纯文本
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <cmath>
  4. #include <cstring>
  5. #include <algorithm>
  6. #define maxn 201
  7. using namespace std;
  8. struct edge{
  9. int ch[maxn],j;
  10. };
  11. edge haha[1010];
  12. bool comp(const edge &a,const edge &b){
  13. for(int i=0;i<maxn;i++){
  14. if(a.ch[i]!=b.ch[i])
  15. return a.ch[i]>b.ch[i];
  16. }
  17. }
  18. int main(){
  19. freopen("brick.in","r",stdin);
  20. freopen("brick.out","w",stdout);
  21. int n;
  22. cin>>n;
  23. cin.get();
  24. memset(haha,0,sizeof(haha));
  25. for(int i=0;i<n;i++){
  26. string s;
  27. getline(cin,s);
  28. //cout<<s<<endl;
  29. haha[i].j=s.size();
  30. for(int j=0;j<s.size();j++){
  31. haha[i].ch[j]=s[j]-'0';
  32. }
  33. }
  34. sort(haha,haha+n,comp);
  35. //cout<<n<<"hsbdh"<<endl;
  36. for(int i=0;i<n;i++){
  37. for(int j=0;j<haha[i].j;j++){
  38. cout<<haha[i].ch[j];
  39. }
  40. }
  41. }