-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
47 lines (41 loc) · 1.02 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <bits/stdc++.h>
#define TASK "task"
using namespace std;
void rwFile() {
freopen(TASK ".in", "r", stdin);
freopen(TASK ".out", "w", stdout);
}
void ForegoneSolution() { /// Code Jam
int t; cin >> t;
for (int i = 1; i <= t; i++) {
cout << "Case #" << i << ": ";
string n; cin >> n;
string a = "", b = "";
for (int j = 0; j < (int)n.size(); j++) {
if (n[j] == '4') {
a += '1';
b += '3';
}
else {
a += n[j];
b += '0';
}
}
int start = 0;
for (int j = 0; i < (int)b.size(); j++) {
if (b[j] != '0') {
start = j;
break;
}
}
string tmp = "";
for (int j = start; j < (int)b.size(); j++) tmp += b[j];
cout << a << ' ' << tmp << '\n';
}
}
int main()
{
ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
rwFile();
ForegoneSolution();
}