Skip to content

Commit 0013f3d

Browse files
authored
Create Problem A.cpp
1 parent 2773937 commit 0013f3d

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

Google-CodeJam/Problem A.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#include<iostream>
2+
#include<vector>
3+
4+
using namespace std;
5+
6+
7+
int main() {
8+
int t;
9+
cin >> t;
10+
11+
for(int i = 0; i < t; i++) {
12+
cout << "Case #" << i+1 << ": ";
13+
14+
string s;
15+
cin >> s;
16+
17+
int n = s.size();
18+
19+
vector<int> other(n, 0);
20+
21+
for(int j = 0; j < n; j++) {
22+
if(s[j] == '4') s[j] = '3', other[j] = 1;
23+
}
24+
25+
cout << s << " " ;
26+
27+
28+
int j;
29+
for(j = 0; other[j] == 0 and j < n; j++);
30+
for(; j < n; j++) cout << other[j];
31+
cout << endl;
32+
33+
34+
}
35+
36+
return 0;
37+
}

0 commit comments

Comments
 (0)