Advertisement
Korotkodul

N5

Nov 27th, 2021 (edited)
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <vector>
  4. #include <set>
  5. #include <string>
  6. #include <algorithm>
  7. using namespace std;
  8. using ll = long long;
  9. void cv(vector <int> v){
  10. for (auto x: v) cout<<x<<' ';
  11. cout<<'\n';
  12. }
  13.  
  14. bool f(bool A, bool B, bool C){
  15. bool a,b,c;
  16. //a = A || !B || !C;
  17. //b = A || B || !C;
  18. //return a&&b;
  19. return A || !C;
  20. }
  21.  
  22. bool ch(bool A, bool B, bool C){
  23. bool r = 0;
  24. bool cmp;
  25. if (A xor B == 1){
  26. cmp = !B || !C;
  27. if (f(A,B,C) == cmp){
  28. r = 1;
  29. }
  30. }
  31. else if (A xor C == 1){
  32. cmp = !C || A && B;
  33. if (f(A,B,C) == cmp){
  34. r = 1;
  35. }
  36. }
  37. else if (B xor C == 0){
  38. cmp = A || !B;
  39. if (f(A,B,C) == cmp){
  40. r = 1;
  41. }
  42. }
  43. return r;
  44. }
  45.  
  46.  
  47. int main()
  48. {
  49. vector <bool> cn = {false, true};
  50. bool r = 1;
  51. for (bool a: cn){
  52. if (!r) break;
  53. for (bool b: cn){
  54. if (!r) break;
  55. for (bool c: cn){
  56. if (!ch(a,b,c)){
  57. r = 0;
  58. cout<<a<<' '<<b<<' '<<c<<'\n';
  59. cout<<"f= "<<f(a,b,c)<<'\n';
  60. break;
  61. }
  62. }
  63. }
  64. }
  65. cout<<"res= "<<r<<'\n';
  66. }
  67.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement