Advertisement
SergeyPGUTI

10.2.2

May 27th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. import java.util.ArrayDeque;
  2. import java.util.ArrayList;
  3. import java.util.Scanner;
  4.  
  5. /**
  6.  * Created by Сергей on 27.05.2016.
  7.  */
  8. public class Sol {
  9.     public static void main(String args[]) {
  10.         Scanner sc = new Scanner(System.in);
  11.         int n, m=0;
  12.         n = sc.nextInt();
  13.  
  14.         while (n>2)
  15.         {
  16.             if (n%2==0) {
  17.                 n=n/2;
  18.             }
  19.             else {
  20.                 n=n/2+1;
  21.             }
  22.             m++;
  23.         }
  24.         System.out.println(m+1);
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement