Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
153304 Kevin 分割排序 C++ Wrong Answer 1 MS 272 KB 1090 2026-05-14 15:35:56

Tests(0/1):


Code:

#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; while (n--) { string s; cin >> s; vector<int> res; // 用这个存数字,最安全 int num = 0; bool has_num = false; // 标记这段是不是真的有数字 for (int i = 0; i < s.size(); i++) { if (s[i] != '5') { num = num * 10 + (s[i] - '0'); has_num = true; } else { if (has_num) { // 只有真的读过数字,才存 res.push_back(num); num = 0; has_num = false; } } } // 最后一段 if (has_num) { res.push_back(num); } // 排序 sort(res.begin(), res.end()); // 输出(无末尾空格,格式正确) for (int i = 0; i < res.size(); i++) { if (i > 0) cout << " "; cout << res[i]; } cout << endl; } return 0; }


Run Info:

------Input------
00000000000000000000000 1234567890987654321 00025158595675234050 56789512345500050059854321 55555123532 00005555987651234515253540500 98751000000005999999995123134500000555346785 000000055555555 00000005555555555550000000000000000 1515151515151515151 555555555500000000000 5555555555500000000000005555555555555555555 12354675789 1234678955555555555098765550001234 12346789 55555555511111111 99999995 12350987655555512 985211 123456789051234567890512345678905123456789051234567890512345678905123456789
------Answer-----
0 1234 4321 678909876 0 1 2 8 9 67 2340 0 0 98 1234 4321 6789 32 123 0 0 1 2 3 40 1234 9876 0 987 34678 123134 99999999 100000000 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 123 467 789 1234 9876 12346789 12346789 11111111 9999999 12 123 9876 98 211 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234
------Your output-----