Advertisement
Korotkodul

Логическая схема. Установочная сессия

Nov 25th, 2021
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 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 x1, bool x2, bool x3){
  15. bool A, B, C, D, E, F, G, H, I, J, K;
  16. A = x1 && !x2;
  17. B = !x1 && x3;
  18. C = x1 && !x2;
  19. D = !x1 && x3;
  20.  
  21. E = A || x3;
  22. F = B || !x2;
  23. G = C || x3;
  24. H = D || !x2;
  25.  
  26.  
  27. I = E && !F;
  28. J = !G && H;
  29.  
  30. K = I || J;
  31.  
  32. return K;
  33. }
  34.  
  35.  
  36. int main()
  37. {
  38. int ans = 0;
  39. vector <bool> al = {false, true};
  40. for (bool a: al){
  41. for (bool b: al){
  42. for (bool c: al){
  43. if (f(a, b, c) == false){
  44. ans++;
  45. }
  46. }
  47. }
  48. }
  49. cout<<"ans= "<<ans<<'\n';
  50. }
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement