提交时间:2023-12-31 13:46:29

运行 ID: 227794

#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; bool f(0); for (int i = 1; i <= n; i++) { cin >> s[i]; if (s[i] != "0") f = 1; } sort(s + 1, s + n + 1, comp); if (!f) cout << 0; else for (int i = 1; i <= n; i++) { cout << s[i]; } }