Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
227793 | 232214陈皓轩 | 基础算法-贪心算法:最大整数 | C++ | 解答错误 | 20 | 0 MS | 288 KB | 546 | 2023-12-31 13:44:37 |
#include <iostream> #include <algorithm> using namespace std; int n; string s[25]; bool comp(string a, string b) { for (int i = 0; i < min(a.size(), b.size()); i++) { if (a[i] < b[i]) return 0; } return 1; } int main() { cin.tie(0),cout.tie(0)->sync_with_stdio(0); cin >> n; int cnt(0); for (int i = 1; i <= n; i++) { cin >> s[i]; if (s[i] == "0") { i--, n--; cnt++; } } sort(s + 1, s + n + 1, comp); for (int i = 1; i <= n; i++) { cout << s[i]; } for (int i = 1; i <= cnt; i++) cout << 0; }