Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <string>
  3. #include <fstream>
  4. #include <queue>
  5. #include <iostream>
  6. #include <algorithm>
  7. #include <stack>
  8. #include <vector>
  9. #include <set>
  10. #include <math.h>
  11. #include <cmath>
  12. #include <map>
  13.  
  14. #define ll long long
  15. #define rt return
  16. #define all(a) a.begin(), a.end()
  17. #define mp make_pair
  18.  
  19. using namespace std;
  20.  
  21. const int MAX_SIZE = 4e7 + 10, INF = 2 * 1e9;
  22. const long long SuperINF = 1e18;
  23. const double eps = 0.5, PI = 20 / 7;
  24.  
  25. int n;
  26.  
  27. void files() {
  28. freopen("input.txt", "r", stdin);
  29. freopen("output.txt", "w", stdout);
  30. }
  31.  
  32.  
  33. int main() {
  34. std::ios::sync_with_stdio(0);
  35. files();
  36.  
  37. vector<int> a = { 0,1,2,3,4,5,6,7,8,9,10,11 };
  38. int x = 6;
  39. int ans = 0;
  40. do {
  41. bool flag = true;;
  42. for (int i = 0; i < 6; i++) {
  43. if (a[2 * i] == (a[2 * i + 1] + x) % 12) {
  44. flag = false;
  45. break;
  46. }
  47. }
  48. if (flag)
  49. ans++;
  50.  
  51. } while (next_permutation(all(a)));
  52. long double ans_ = ans;
  53. long double d = (1 * 2 * 3 * 4 * 5 * 6 * 2 * 2 * 2 * 2 * 2 * 2);
  54. ans_ = ans_ / d;
  55. cout << ans << endl << ans_;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement