-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathownNumberSystem.cpp
More file actions
35 lines (33 loc) · 928 Bytes
/
ownNumberSystem.cpp
File metadata and controls
35 lines (33 loc) · 928 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
32
33
34
35
#include <bits/stdc++.h>
using namespace std;
#define ll long long
// #define int long long
#define pb(x) push_back(x);
#define ce(x) cout << x << '\n';
#define db long double;
using pll = pair < ll, ll >;
#define scan(a, n) for(int i = 0; i < n; i++)cin >> a[i];
#define rep(i,x,n) for(ll i=x ; i<n ; i++)
#define per(i,x,n) for( i=x ; i>n ; i--)
#define hell 1000000007
#define infl LLONG_MAX
#define Foxen(i,s) for (i=s.begin(); i!=s.end(); i++)
#define Fill(s,v) memset(s,v,sizeof(s))
#define cout_p(x, p) cout << fixed << setprecision((p)) << x << endl //print with precision
#define tc(tt) \
ll tt; \
cin >> tt; \
while(tt--) // testcase
int main() {
int n;
cin>>n;
string str=to_string(n);
int res=0;
for(int i=0;i<str.length(); i++) {
res*=3;
if(str[i]=='2') res+=1;
if(str[i]=='4') res+=2;
if(str[i]=='8') res+=3;
}
cout<<res<<endl;
}