QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#560723 | #6407. Classical A+B Problem | Apteryxx | WA | 0ms | 3648kb | C++20 | 1.0kb | 2024-09-12 17:31:55 | 2024-09-12 17:31:56 |
Judging History
answer
#include <bits/stdc++.h>
#ifdef LOCAL
#include <debug.h>
#else
#define debug(...)
#define debug_arr(...)
#define debug_endl(...)
#endif
void solve() {
std::string s;
std::cin >> s;
int n = s.length();
std::vector<int> a(n);
for (int i = 0; i < n; i++) {
a[i] = s[n - i - 1] - '0';
}
for (int i = n - 1; i <= n; i++) {
for (int j = 1; j <= 9; j++) {
auto b = a;
for (int k = 0; k < i; k++) {
b[k] -= j;
}
for (int k = 0; k < n - 1; k++) {
if (b[k] < 0) {
b[k] += 10;
b[k + 1]--;
}
}
while (!b.empty() && b.back() == 0) {
b.pop_back();
}
if (!b.empty() && b[0] > 0 && b == std::vector(b.size(), b[0])) {
std::cout << std::string(b.size(), '0' + b[0]) << " " << std::string(i, '0' + j) << "\n";
return;
}
}
}
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.setf(std::ios::fixed);
std::cout.precision(10);
int t;
std::cin >> t;
while (t--) {
solve();
debug_endl(std::endl);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3648kb
input:
6 2 786 1332 89110 2333333 10000000000000000000000000001
output:
2 9 777 999 333 222 88888 2222222 111111 2 9999999999999999999999999999
result:
wrong answer x + y != n (test case 1)