Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|---|
227850 | 232217赵泽宇 | 基础算法-贪心算法:最大整数 | C++ | Wrong Answer | 0 | 0 MS | 280 KB | 425 | 2023-12-31 14:58:08 |
#include <bits/stdc++.h> using namespace std; struct node { string x; int b; }a[22]; bool cmp(node x,node y) { return x.b+y.b>y.b+x.b; } int main() { int n; cin>>n; for(int i = 1;i <= n;i++) { cin>>a[i].x; } for(int i = 1;i <= n;i++) { a[i].b = (stoi(a[i].x))/(pow(10,a[i].x.size()-1)); } sort(a+1,a+n+1,cmp); for(int i = 1;i <= n;i++) { cout<<a[i].x; } return 0; }