Advertisement
artemgf

Копирование

Feb 17th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.35 KB | None | 0 0
  1. /*#include <iostream>
  2. #include <string>
  3. #include <map>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int age, i, n;
  9.     string s;
  10.     map<int, int> a;
  11.     cin >> n;
  12.     for (i = 0; i < n; i++)
  13.     {
  14.         cin >> age;
  15.         a[age]++;
  16.     }
  17.     map<string, int>::iterator iter;
  18.     for (iter = a.begin(); iter != a.end(); iter++)
  19.         cout << iter->first << " " << iter->second << endl;
  20.     system("pause");
  21.     return 0;
  22. }*/
  23. #define _USE_MATH_DEFINES
  24. #include <iostream>
  25. #include <string>
  26. #include <map>
  27. #include <set>
  28. #include <algorithm>
  29. #include <vector>
  30. #include <stdio.h>
  31. #include <cmath>
  32. #include <math.h>
  33. #include <queue>
  34. #include <stack>
  35. #include <climits>
  36. #include <deque>
  37. #include <ctime>
  38.  
  39. using namespace std;
  40.  
  41. typedef long long ll;
  42. typedef unsigned long long ull;
  43. typedef unsigned int ui;
  44.  
  45. #define mh() make_heap()
  46. #define poph() pop_heap()
  47. #define pushh() push_heap()
  48. #define sor(n) n.begin(), n.end()
  49. #define rsor(n) n.rbegin(), n.rend()
  50. #define mp make_pair
  51. #define files freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout)
  52. #define p(T) pair<T,T>
  53. #define znac(l) abs(l)/l
  54. const ll ok = ll(1e9 + 7);
  55.  
  56. int main()
  57. {
  58. #ifndef ONLINE_JUDGE
  59.     files;
  60. #endif
  61.     ll n, k;
  62.     cin >> n >> k;
  63.     ll p = 1;
  64.     ll sc = 0;
  65.     n -= p;
  66.     while (p<=k&&n>0)
  67.     {
  68.         n -= p;
  69.         sc++;
  70.         p *= 2;
  71.     }
  72.     if (n >0)
  73.         sc += n / k + bool(n%k);
  74.     cout << sc;
  75.     return 0;
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement