Guest User

Untitled

a guest
Sep 12th, 2019
97
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. class Program
  6. {
  7. public static void Main(string[] args)
  8. {
  9. int n = int.Parse(Console.ReadLine());
  10. bool hasMaxEvenNumFound = false;
  11. List<int> intList = new List<int>();
  12.  
  13. for (int i = 1; i <= n; i++)
  14. {
  15. int tmp = i;
  16. int cnt = 0;
  17. int cnt2 = 0;
  18.  
  19. bool isEven = true;
  20. while (isEven)
  21. {
  22. if (i % 2 == 0 && tmp != 0)
  23. {
  24. tmp /= 2;
  25. cnt++;
  26. }
  27. else
  28. {
  29. isEven = false;
  30. intList.Add(cnt);
  31. }
  32. }
  33.  
  34. }
  35.  
  36. Console.WriteLine(intList.IndexOf(intList.Max())+1);
  37. }
  38. }
RAW Paste Data