Korotkodul

Котех N1

Dec 14th, 2021 (edited)
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <vector>
  4. #include <queue>
  5. #include <algorithm>
  6. #include <string>
  7. #include <stack>
  8. #include <set>
  9. #include <map>
  10. #define pii pair <int,int>
  11. using namespace std;
  12. using ll = long long;
  13. using ld = long double;
  14. void cv(vector <int> &v){
  15. for (auto x: v) cout<<x<<' ';
  16. cout<<"\n\n";
  17. }
  18. bool ch(int a, int b, int c){
  19. return a != b && b != c && a != c;
  20. }
  21. vector <int> v;
  22. //дуга
  23. bool inj(int p1, int p2, int p3){//p3 НЕ ледит между p1 и p2
  24. if (p1 > p2) swap(p1, p2);
  25. int id1, id2;
  26. id1 = p1 + 12 - p2;
  27. id2 = p2 - p1;
  28. int r;
  29. if (p1 < p3 && p3 < p2) r = id1 * 15;
  30. else if (p1 == 0 && p3 <= 11 && p3>p2) r = id2*15;
  31. else r = 15 * id2;
  32.  
  33. return r < 90;
  34. }
  35.  
  36. void sh(int p1, int p2, int p3){//p3 НЕ ледит между p1 и p2
  37. if (p1 > p2) swap(p1, p2);
  38. int id1, id2;
  39. id1 = p1 + 12 - p2;
  40. id2 = p2 - p1;
  41. int r;
  42. cout<<"id1 = "<<id1<<"\n";
  43. cout<<"id2= "<<id2<<"\n";
  44. if (p1 < p3 && p3 < p2) {
  45. cout<<"one\n";
  46. r = id1 * 15;
  47.  
  48. }
  49. else if (p1 == 0 && p3 <= 11 && p3>p2){
  50. cout<<"two\n";
  51. r = id2*15;
  52. }
  53. else {cout<<"three\n";
  54. r = 15 * id2;
  55. }
  56. cout<<"r= "<<r<<"\n";
  57. //return r < 90;
  58. }
  59.  
  60.  
  61. int ug(int p1, int p2, int p3){//p3 НЕ ледит между p1 и p2
  62. if (p1 > p2) swap(p1, p2);
  63. int id1, id2;
  64. id1 = p1 + 12 - p2;
  65. id2 = p2 - p1;
  66. int r;
  67. if (p1 < p3 && p3 < p2) r = id1 * 15;
  68. else if (p1 == 0 && p3 <= 11 && p3>p2) r = id2*15;
  69. else r = 15 * id2;
  70.  
  71. return r;
  72. }
  73.  
  74. int main()
  75. {
  76. ios::sync_with_stdio(0);
  77. cin.tie(0);
  78. cout.tie(0);
  79.  
  80. for (int i=0;i<4;++i){
  81. v.push_back(1);
  82. v.push_back(2);
  83. v.push_back(3);
  84. }
  85. //cv(v);
  86. int ans=0;
  87. for (int a = 0; a < 12; ++a){
  88. for (int b = 0; b < 12; ++b){
  89. for (int c=0;c<12;++c){
  90. if (ch(a,b,c) && ch(v[a], v[b], v[c])){
  91. if(inj(a,b,c) && inj(b,c,a) && inj(c,a,b)){
  92. ans++;
  93. //cout<<a<<' '<<b<<' '<<c<<" ug= "<<ug(a,b,c)<<'\n';
  94. }
  95. }
  96. }
  97. }
  98. }
  99. //cout<<ans<<'\n';
  100. sh(7, 9, 2);
  101. }
  102. //7 9 2
  103.  
Add Comment
Please, Sign In to add comment