Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- const int n = 16;
- int main() {
- bool a[n], b[n], c[n], d[n], rez[n];
- bool pol[n];
- int x = 0, t1, t2, t3, i, k = 0, m = 0;
- int count1 =0, count=0, j = 0;
- int temp[10];
- int T0=0, T1=0, tm=0, tl=0, ts=0;
- a[k] = 0; b[k] = 0; c[k] = 0; d[k] = 0;
- cout << 'A' << ' ' << 'B' << ' ' << 'C' << ' ' << 'D' << ' ' << 'f' << endl;
- for (int j = 0; j < n - 1; j++) {
- rez[j] = a[k] && b[k] || !c[k] || !d[k];
- x++;
- t1 = x;
- for (i = 0; i < 4; i++) {
- temp[i] = 0;
- }
- i = 0;
- if (t1 == 1) temp[0] = 1;
- while (t1 >= 2) {
- m++;
- t2 = t1;
- t1 /= 2;
- t3 = t2 - t1 * 2;
- temp[i] = t3;
- i++;
- temp[i] = 1;
- }
- k++;
- d[k] = temp[0];
- c[k] = temp[1];
- b[k] = temp[2];
- a[k] = temp[3];;
- }
- rez[x] = rez[j] = a[k] && b[k] || !c[k] && !d[k];
- for (i = 0; i < n; i++) {
- cout << a[i] << ' ' << b[i] << ' ' << c[i] << ' ' << d[i] << ' ' << rez[i];
- cout << endl;
- }
- cout << endl << endl;
- //T0
- if (rez[0] == 0) T0 = 1;
- //T1
- if (rez[15] == 1) T1 = 1;
- //Монотонность
- for (i = 0; i < n-1; i++) {
- if (rez[i] < rez[i + 1]) count++;
- }
- if (count == 0) tm = 1;
- //Линейность
- i = n;
- for (int m = 0; m < n; m++) {
- while (j != i-1) {
- if ((rez[j] == 0 && rez[j + 1] == 1) || (rez[j] == 1 && rez[j + 1] == 0)) {
- rez[j] = 1;
- }
- else rez[j] = 0;
- cout << rez[j];
- j++;
- }
- cout << endl;
- i--;
- pol[m] = rez[0];
- j = 0;
- }
- count = 0;
- for (i = 0; i < n; i++) {
- if (pol[i] == 1) {
- if (a[i] == 1) count1++;
- if (b[i] == 1) count1++;
- if (c[i] == 1) count1++;
- if (d[i] == 1) count1++;
- }
- if (count1 > count) count = count1;
- count1 = 0;
- }
- cout << count;
- if (count <= 1) tl = 1;
- cout << endl;
- //Самодвойственность
- j = n-1;
- for (i = 0; i < n / 2; i++) {
- if (rez[i] == rez[j]) count++;
- }
- if (count == 0) ts = 1;
- cout << T0 << ' ' << T1 << ' ' << tm << ' ' << tl << ' ' << ts;
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement