fork(5) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define Foreach(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
  4. #define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i))
  5. #define rof(i,a,b) for(int (i)=(a);(i) > (b); --(i))
  6. #define rep(i, c) for(auto &(i) : (c))
  7. #define x first
  8. #define y second
  9. #define pb push_back
  10. #define PB pop_back()
  11. #define iOS ios_base::sync_with_stdio(false)
  12. #define sqr(a) (((a) * (a)))
  13. #define all(a) a.begin() , a.end()
  14. #define error(x) cerr << #x << " = " << (x) <<endl
  15. #define Error(a,b) cerr<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
  16. #define errop(a) cerr<<#a<<" = ( "<<((a).x)<<" , "<<((a).y)<<" )\n";
  17. #define coud(a,b) cout<<fixed << setprecision((b)) << (a)
  18. #define L(x) ((x)<<1)
  19. #define R(x) (((x)<<1)+1)
  20. #define umap unordered_map
  21. //#define max(x,y) ((x) > (y) ? (x) : (y))
  22. #define double long double
  23. typedef long long ll;
  24. typedef pair<int,int>pii;
  25. typedef vector<int> vi;
  26. typedef complex<double> point;
  27. inline ll binary(string n){
  28. ll ans = 0LL;
  29. For(i,0,n.size())
  30. ans = (2LL*ans + (ll)(n[i]-'0'));
  31. ll p = 1LL;
  32. For(i,0,n.size())
  33. p = (p << 1);
  34. ans += p-1LL;
  35. return ans;
  36. }
  37. inline string lu(string s){
  38. For(i,0,s.size())
  39. s[i] = (char)(s[i]=='4'?'0':'1');
  40. return s;
  41. }
  42. int main(){
  43. iOS;
  44. string n;
  45. cin >> n;
  46. cout << binary(lu(n)) << endl;
  47. }
  48.  
Success #stdin #stdout 0s 3276KB
stdin
Standard input is empty
stdout
0