-
Notifications
You must be signed in to change notification settings - Fork 186
Expand file tree
/
Copy patha.cc
More file actions
31 lines (31 loc) · 651 Bytes
/
a.cc
File metadata and controls
31 lines (31 loc) · 651 Bytes
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
// https://codingcompetitions.withgoogle.com/codejam/round/0000000000051705/0000000000088231
#include<bits/stdc++.h>
using namespace std;
using vi=vector<int>;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin>>t;
for(int T=1;T<=t;T++){
string s;
cin>>s;
int n=s.size();
vi a(n),b(n);
for(int i=0;i<n;i++){
a[i]=s[n-i-1]-'0';
if(a[i]==4){
a[i]--;
b[i]=1;
}
}
while(!b.back())b.pop_back();
reverse(a.begin(),a.end());
reverse(b.begin(),b.end());
cout<<"Case #"<<T<<": ";
for(int x:a)cout<<x;
cout<<" ";
for(int x:b)cout<<x;
cout<<"\n";
}
}