|
| 1 | +#include <bits/stdc++.h> |
| 2 | + |
| 3 | +using namespace std; |
| 4 | +using pii = pair<int, int>; |
| 5 | + |
| 6 | +const int unit[7] = {1000000, 100000, 10000, 1000, 100, 10, 1}; |
| 7 | + |
| 8 | +pii solve(string &s) |
| 9 | +{ |
| 10 | + pii res; |
| 11 | + int i, d, len = s.size(); |
| 12 | + for (i = 0; i < len; i++) |
| 13 | + { |
| 14 | + d = s[i] - '0'; |
| 15 | + res.second += (d == 5 ? 6 : d) * unit[i + 7 - len]; |
| 16 | + res.first += (d == 6 ? 5 : d) * unit[i + 7 - len]; |
| 17 | + } |
| 18 | + return res; |
| 19 | +} |
| 20 | + |
| 21 | +int main() |
| 22 | +{ |
| 23 | + ios::sync_with_stdio(false); |
| 24 | + cin.tie(nullptr); |
| 25 | + cout.tie(nullptr); |
| 26 | + string a, b; |
| 27 | + cin >> a >> b; |
| 28 | + pii ans_a = solve(a), ans_b = solve(b); |
| 29 | + cout << ans_a.first + ans_b.first << " " << ans_a.second + ans_b.second; |
| 30 | + return 0; |
| 31 | +} |
0 commit comments