fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define MOD 1000000007
  4. #define LL long long
  5. #define out(x) cout << #x << " : " << x << "\n";
  6.  
  7. int main() {
  8. ios_base::sync_with_stdio(false); cin.tie(NULL);
  9. LL n; cin >> n;
  10. LL k = floor(log10(n)) + 1;
  11. LL p = pow(10, k);
  12. double p2 = 1.0;
  13. for(LL i = 0;i <= 100000000;i++) {
  14. while(p2 >= p) p2 /= 10;
  15. if((LL)(p2) == n) {
  16. cout << i << endl;
  17. return 0;
  18. }
  19. p2 = p2 * 2ll;
  20. }
  21. cout << -1 << endl;
  22. return 0;
  23. }
Success #stdin #stdout 0s 3276KB
stdin
82
stdout
209