-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_Chewba_ca_and_Number.cpp
More file actions
64 lines (58 loc) · 1.12 KB
/
A_Chewba_ca_and_Number.cpp
File metadata and controls
64 lines (58 loc) · 1.12 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<queue>
#define ll long long int
#define pb push_back
#define fo(i,n) for(int i=0;i<n;i++)
#define ff(i,n) for(int i=n-1;i>=0;i--)
#define YES cout<< 'YES' << endl
#define NO cout<< 'NO' << endl
using namespace std;
const int E = 2e3 + 100;
const int mod = 1e9 + 7;
// void accepted(ll n)
// {
// ll a[20] , r , i = 0;
// while(n>0) {
// r = n % 10;
// if (9-r>r) a[i] = r;
// else a[i] = 9 - r;
// i++;
// n /= 10;
// }
// if(a[i-1]==0) {
// cout << 9;
// i--;
// }
// for(ll j=i-1;j>=0;j--){
// cout << a[j];
// }
// }
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t=1;//cin>>t;
while(t--)
{
ll n;cin>>n;
ll a[20] , r , i = 0;
while(n>0) {
r = n % 10;
if (9-r>r) a[i] = r;
else a[i] = 9 - r;
i++;
n /= 10;
}
if(a[i-1]==0) {
cout << 9;
i--;
}
for(ll j=i-1;j>=0;j--){
cout << a[j];
}
//accepted(x);
}
return 0;
} //Code Contributed by Harshit Varshney