Skip to content

Instantly share code, notes, and snippets.

@Kanst
Created December 8, 2012 08:03
Show Gist options
  • Save Kanst/4239184 to your computer and use it in GitHub Desktop.
Save Kanst/4239184 to your computer and use it in GitHub Desktop.
#include <iostream>
#include<vector>
#include<math.h>
using namespace std;
int sum(int a,int b)
{
int mas[2][2]={{0,1},{1,1}};
int aplusb;
aplusb=mas[a][b];
return aplusb;
}
int umn(int a,int b)
{
int mas[2][2]={{0,0},{0,1}};
int aplusb;
aplusb=mas[a][b];
return aplusb;
}
int ne(int a)
{
int mas[2]={1,0};
int aplusb;
aplusb=mas[a];
return aplusb;
}
int noizm(int a,int b,int d,int e)
{
int f,g,m,h,l,n,k,s,r;
//int *mas = new int ;
f = umn(b,d);
//mas[0] = f;
//cout<<"f = "<<f<<"\n";
g = umn(a,d);
//mas[1] = g;
//cout<<"g = "<<g<<"\n";
h = ne(umn(a,f));
//mas[2] = h;
//cout<<"h = "<<h<<"\n";
m = sum(f,g);
//mas[3] = m;
//cout<<"m = "<<m<<"\n";
l = umn(h,f);
///mas[4] = l;
//cout<<"l = "<<l<<"\n";
n = umn(m,e);
//mas[5] = n;
//cout<<"n = "<<n<<"\n";
k = ne(umn(m,l));
///mas[6] = k;
//cout<<"k = "<<k<<"\n";
s = umn(l,n);
//mas[7] = s;
//cout<<"s = "<<s<<"\n";
r = sum(sum(h,k),s);
//mas[8] = r;
//cout<<"r = "<<r<<"\n";
return r;
}
int izmper(int a,int b,int d,int e)
{
int f,g,m,h,l,n,k,s,r,d1,d2,a1,a2,f1,f2,f3,h1,h2,m1,m2,l1,l2;
d1 = d;
d2 = d;
f = umn(b,d2);
//cout<<"f = "<<f<<"\n";
a1 = a;
a2 = a;
g = umn(a2,d1);
//cout<<"g = "<<g<<"\n";
f1 = f;
f2 = f;
f3 = f;
h = ne(umn(a1,f1));
//cout<<"h = "<<h<<"\n";
m = sum(f3,g);
//cout<<"m = "<<m<<"\n";
h1 = h;
h2 = h;
l = umn(h2,f2);
//cout<<"l = "<<l<<"\n";
m1 = m;
m2 = m;
n = umn(m2,e);
//cout<<"n = "<<n<<"\n";
n = n;
l1 = l;
l2 = l;
k = ne(umn(m1,l1));
//cout<<"k = "<<k<<"\n";
k = k;
s = umn(l2,n);
//cout<<"s = "<<s<<"\n";
s = s;
r = sum(sum(h1,k),s);
r = r;
// cout<<"r = "<<r<<"\n";
return r;
}
int prov()
{
int s,um,um1,um3,um4;
int mas[16][4] = {{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{0,1,0,0},{0,1,0,1},{0,1,1,0},{0,1,1,1},{1,0,0,0},{1,0,0,1},{1,0,1,0},{1,0,1,1},{1,1,0,0},{1,1,0,1},{1,1,1,0},{1,1,1,1}};
/*for(int i=0; i<=15; i++)
{
for(int j=0;j<=3;j++)
{
cout<<mas[i][j]<<' ';
}
cout<<'\n';
}*/
for(int i=0;i<=15;i++)
{
um = noizm(mas[i][0],mas[i][1],mas[i][2],mas[i][3]);
um1 = izmper(mas[i][0],mas[i][1],mas[i][2],mas[i][3]);
if (um == um1)
{
cout<<"При a = "<<mas[i][0]<<", b = "<<mas[i][1]<<", d = "<<mas[i][2]<<", e = "<<mas[i][3]<<'\n';
cout<<"Результат вычисления: "<<um<<"\nРезультат с замыканием: "<<um1<<"\n";
//cout<<"Все заебись\n";
}
else
{
cout<<"При a = "<<mas[i][0]<<", b = "<<mas[i][1]<<", d = "<<mas[i][2]<<", e = "<<mas[i][3]<<'\n';
cout<<"Результат вычисления: "<<um<<"\nРезультат с замыканием: "<<um1<<"\n";
cout<<"Все не заебись\n";
break;
}
}
}
int main()
{
prov();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment