fork download
  1. #include <iostream>
  2. #include <cstring>
  3. #include <string>
  4. #include <cmath>
  5. using namespace std ;
  6.  
  7. int main()
  8. {
  9. #ifndef ONLINE_JUDGE
  10. freopen("input.txt", "r", stdin);
  11. freopen("output.txt", "w", stdout);
  12. #endif
  13. int n;
  14. bool op= false ;
  15. bool stop = false ;
  16. int operations = 0;
  17. cin >> n ;
  18. int a[n];
  19. for (int i = 0; i < n; i++)
  20. {cin >> a[i];}
  21.  
  22. while (stop == false)
  23. {
  24. for (int k = 0; k < n; k++)
  25. {
  26. if (a[k] % 2 == 0)
  27. {
  28. op = true ;
  29. // operations += 1;
  30. a[k] /= 2 ;
  31. }
  32. else if(a[k] %2 != 0)
  33. { op=false;
  34. stop = true;
  35. break;
  36. }
  37.  
  38.  
  39. }
  40.  
  41. if (op==true)
  42. {
  43. operations+=1;
  44. }
  45.  
  46. }
  47. cout << operations;
  48.  
  49.  
  50. }
Success #stdin #stdout 0s 548KB
stdin
Standard input is empty
stdout
Standard output is empty