fork(12) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int n;
  7. cin >> n;
  8. int len = 0;
  9. int ans = 0;
  10. while (n) {
  11. if (n % 10 == 7)
  12. ans += (1 << len);
  13. n /= 10;
  14. len++;
  15. }
  16. for (int i = 1; i < len; i++)
  17. ans += (1 << i);
  18. cout << ans + 1 << endl;
  19. return 0;
  20. }
Success #stdin #stdout 0s 3144KB
stdin
Standard input is empty
stdout
513