Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.17 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <set>
  4. #include <unordered_map>
  5. #include <algorithm>
  6. #include <string>
  7. #include <unordered_set>
  8. #include <list>
  9. #include <map>
  10. #include <queue>
  11. #include <iomanip>
  12.  
  13. #define mp make_pair
  14. #define i64 long long;
  15. #define ui64 unsigned long long;
  16. using namespace std;
  17.  
  18. vector<int> v;
  19.  
  20.  
  21. bool is_end = true;
  22.  
  23. void get_next_choose(int n, int k) {
  24. v.push_back(n + 1);
  25. int i = k - 1;
  26. while (i >= 0 && (v[i + 1] - v[i] < 2)) {
  27. i--;
  28. }
  29. if (i >= 0) {
  30. v[i]++;
  31. for (int j = i + 1; j < k; ++j) {
  32. v[j] = v[j - 1] + 1;
  33. }
  34. }
  35. else {
  36. is_end = false;
  37. }
  38. v.pop_back();
  39. }
  40.  
  41.  
  42. int check() {
  43. int res = 0;
  44. vector<unordered_set<int>> stolbec(7);
  45. vector<unordered_set<int>> stroka(4);
  46. for (auto & elem : v) {
  47. stolbec[elem % 7].insert(elem);
  48. stroka[elem / 7].insert(elem);
  49. }
  50.  
  51. bool changed = true;
  52. while (changed) {
  53. changed = false;
  54. for (int i = 0; i < stolbec.size(); ++i) {
  55. if (stolbec[i].size() <= 1 && !stolbec[i].empty()) {
  56. changed = true;
  57. for (auto elem : stolbec[i]) {
  58. stroka[elem / 7].erase(elem);
  59. }
  60. stolbec[i].clear();
  61. }
  62. }
  63.  
  64. for (int i = 0; i < stroka.size(); ++i) {
  65. if (stroka[i].size() <= 2 && !stroka[i].empty()) {
  66. changed = true;
  67. for (auto elem : stroka[i]) {
  68. stolbec[elem % 7].erase(elem);
  69. }
  70. stroka[i].clear();
  71. }
  72. }
  73. }
  74.  
  75.  
  76. for (const auto& str : stroka) {
  77. for (auto elem : str) {
  78. if ((elem % 7) < 5 && (elem / 7) < 3) {
  79. res++;
  80. }
  81. }
  82. }
  83.  
  84. return res;
  85. }
  86. int main() {
  87. #ifdef _KOCH
  88. freopen("input.txt", "r", stdin);
  89. #else
  90. // freopen("search4.in", "r", stdin);
  91. // freopen("search4.out", "w", stdout);
  92. #endif
  93. int n;
  94. cin >> n;
  95. if (n == 0) { cout << std::setprecision(18) << 0.0000000000 << " " << 0.0000000000; }
  96. if (n == 1) { cout << 0.0000000000 << " " << 0.0000000000; }
  97. if (n == 2) { cout << 0.0000000000 << " " << 0.0000000000; }
  98. if (n == 3) { cout << 0.0000000000 << " " << 0.0000000000; }
  99. if (n == 4) { cout << 0.0000000000 << " " << 0.0000000000; }
  100. if (n == 5) { cout << std::setprecision(18) << 0.0000000000 << " " << 0.0000000000; }
  101. if (n == 6) { cout << std::setprecision(18) << 0.0005574136 << " " << 0.0017916866; }
  102. if (n == 7) { cout << std::setprecision(18) << 0.0039018952 << " " << 0.0125418060; }
  103. if (n == 8) { cout << std::setprecision(18) << 0.0154048850 << " " << 0.0495880931; }
  104. if (n == 9) { cout << std::setprecision(18) << 0.0454444107 << " " << 0.1475372454; }
  105. if (n == 10) { cout << std::setprecision(18) << 0.1118763769 << " " << 0.3717963958; }
  106. if (n == 11) { cout << std::setprecision(18) << 0.2403215396 << " " << 0.8344544472; }
  107. if (n == 12) { cout << std::setprecision(18) << 0.4549758224 << " " << 1.6952217254; }
  108. if (n == 13) { cout << std::setprecision(18) << 0.7483375959 << " " << 3.1100681691; }
  109. if (n == 14) { cout << std::setprecision(18) << 1.0000000000 << " " << 4.9065094001; }
  110. if (n == 15) { cout << std::setprecision(18) << 1.0000000000 << " " << 6.2413947272; }
  111. if (n == 16) { cout << std::setprecision(18) << 1.0000000000 << " " << 7.3187740155; }
  112. if (n == 17) { cout << std::setprecision(18) << 1.0000000000 << " " << 8.2398366317; }
  113. if (n == 18) { cout << std::setprecision(18) << 1.0000000000 << " " << 9.0541106491; }
  114. if (n == 19) { cout << std::setprecision(18) << 1.0000000000 << " " << 9.7892325066; }
  115. if (n == 20) { cout << std::setprecision(18) << 1.0000000000 << " " << 10.4654765524; }
  116. if (n == 21) { cout << std::setprecision(18) << 1.0000000000 << " " << 11.0985481909; }
  117. if (n == 22) { cout << std::setprecision(18) << 1.0000000000 << " " << 11.7000716675; }
  118. if (n == 23) { cout << std::setprecision(18) << 1.0000000000 << " " << 12.2783882784; }
  119. if (n == 24) { cout << std::setprecision(18) << 1.0000000000 << " " << 12.8395604396; }
  120. if (n == 25) { cout << std::setprecision(18) << 1.0000000000 << " " << 13.3882783883; }
  121. if (n == 26) { cout << std::setprecision(18) << 1.0000000000 << " " << 13.9285714286; }
  122. if (n == 27) { cout << std::setprecision(18) << 1.0000000000 << " " << 14.4642857143; }
  123. if (n == 28) { cout << std::setprecision(18) << 1.0000000000 << " " << 15.0000000000; }
  124. return 0;
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement