Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
151305 李鸣 分割排序 C++ Accepted 1 MS 276 KB 889 2026-04-11 16:33:03

Tests(1/1):


Code:

#include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; int main() { string s; while (cin >> s) { vector<long long> res; string tmp; for (char c : s) { if (c == '5') { if (!tmp.empty()) { res.push_back(stoll(tmp)); tmp.clear(); } } else { tmp += c; } } // 处理最后一段 if (!tmp.empty()) res.push_back(stoll(tmp)); sort(res.begin(), res.end()); for (int i = 0; i < res.size(); ++i) { if (i > 0) cout << ' '; cout << res[i]; } cout << endl; } return 0; }