Untitled
unknown
plain_text
2 years ago
870 B
2
Indexable
Never
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define FOR(i,a,b) for (int i=a;i<=b;i++) #define FOR_ll(i,a,b) for (ll i=a;i<=b;i++) #define REP(i,a,b) for (int i=a;i>=b;i--) #define MAX(a,b,c) max(a,max(b,c)) #define MIN(a,b,c) min(a,min(b,c)) #define ii pair<int,int> #define F first #define S second #define PB push_back int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin>>n; int k=1, d=1; while (1) { k*=2; if (n-k>=0) n-=k; else break; d++; } if (n==0) { FOR(i,1,d-1) cout<<'7'; } else { n--; bitset<20> a; a=n; REP(i,d-1,0) if (a[i]==0) cout<<4; else cout<<7; } return 0; }