fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int N, counter=0;
  6. cin >> N;
  7. while(N!=1){
  8. counter++;
  9. if(N%2==0){
  10. N = N/2;
  11. }
  12. else{
  13. N++;
  14. }
  15. }
  16. cout << counter << endl;
  17. return 0;
  18. }
Success #stdin #stdout 0s 3464KB
stdin
43
stdout
9