这个是换了一种方法,有点麻烦

魈凯KBS  •  5个月前


include<bits/stdc++.h>

using namespace std; int main(){

int a,b,c,d;
cin>>a>>b>>c>>d;
if(a==0&b==0&c==0&d==0)
	cout<<"0"<<endl;
if(a==1&b==1&c==1&d==1)
	cout<<"0"<<endl;
if(a==0&b==0&c==0&d==1)
	cout<<"1"<<endl;
if(a==0&b==0&c==1&d==0)
	cout<<"1"<<endl;
if(a==0&b==1&c==0&d==0)
	cout<<"1"<<endl;
if(a==1&b==0&c==0&d==0)
	cout<<"1"<<endl;
if(a==1&b==1&c==1&d==0)
	cout<<"1"<<endl;
if(a==1&b==1&c==0&d==1)
	cout<<"1"<<endl;
if(a==1&b==0&c==1&d==1)
	cout<<"1"<<endl;
if(a==0&b==1&c==1&d==1)
	cout<<"1"<<endl;
if(a==1&b==1&c==0&d==0)
	cout<<"2"<<endl;
if(a==1&b==0&c==1&d==0)
	cout<<"2"<<endl;
if(a==1&b==0&c==0&d==1)
	cout<<"2"<<endl;
if(a==0&b==1&c==0&d==1)
	cout<<"2"<<endl;
if(a==0&b==1&c==1&d==0)
	cout<<"2"<<endl;
if(a==0&b==0&c==1&d==1)
	cout<<"2"<<endl;
return 0;

}


评论:

这个是枚举,百分百对


魈凯KBS  •  5个月前