比赛 |
防止浮躁的小练习v0.3 |
评测结果 |
AWAWAWWWWA |
题目名称 |
数字积木 |
最终得分 |
40 |
用户昵称 |
asddddd |
运行时间 |
0.058 s |
代码语言 |
C++ |
内存使用 |
1.09 MiB |
提交时间 |
2016-10-12 17:34:27 |
显示代码纯文本
- #include <iostream>
- #include <cstdio>
- #include <cmath>
- #include <cstring>
- #include <algorithm>
- #define maxn 201
- using namespace std;
- struct edge{
- int ch[maxn],j;
- };
- edge haha[1010];
- bool comp(const edge &a,const edge &b){
- for(int i=0;i<maxn;i++){
- if(a.ch[i]!=b.ch[i])
- return a.ch[i]>b.ch[i];
- }
- }
- int main(){
- freopen("brick.in","r",stdin);
- freopen("brick.out","w",stdout);
- int n;
- cin>>n;
- cin.get();
- memset(haha,0,sizeof(haha));
- for(int i=0;i<n;i++){
- string s;
- getline(cin,s);
- //cout<<s<<endl;
- haha[i].j=s.size();
- for(int j=0;j<s.size();j++){
- haha[i].ch[j]=s[j]-'0';
- }
- }
- sort(haha,haha+n,comp);
- //cout<<n<<"hsbdh"<<endl;
- for(int i=0;i<n;i++){
- for(int j=0;j<haha[i].j;j++){
- cout<<haha[i].ch[j];
- }
- }
- }