旧时光丶


私信TA

用户名:1475318935

访问量:3473

签 名:

等  级
排  名 1602
经  验 2660
参赛次数 0
文章发表 5
年  龄 0
在职情况 学生
学  校 安徽理工大学
专  业

  自我简介:

解题思路:

注意事项:

参考代码:

#include<iostream>

using namespace std;

bool  fun1(int a,int b)

{

if(a+b>=1) return true;

else return false;

}


bool fun2(int a,int b)

{

if(a+b<2) return true;

else return false;

}


bool fun3(int a,int b,int c)

{

if(a+b+c==2) return true;

else return false;

}


bool fun4(int a,int b)

{

if(a+b==0||a+b==2) return true;

else return false;

}


bool fun5(int a,int b)

{

if(a+b==1) return true;

else return false;

}


bool fun6(int a,int b)

{

if(a==0&&b==1) return false;

else return true;

}



int main()

{

int A,B,C,D,E,F;

for(A=0;A<2;A++)

for(B=0;B<2;B++)

for(C=0;C<2;C++)

for(D=0;D<2;D++)

for(E=0;E<2;E++)

for(F=0;F<2;F++)

if(fun1(A,B)&&fun2(A,D)&&fun3(A,E,F)&&fun4(B,C)&&fun5(C,D)&&fun6(D,E))

{

if(A==1) cout<<"A,";

                           if(B==1) cout<<"B,";

                           if(C==1) cout<<"C,";

                           if(D==1) cout<<"D,";

                           if(E==1) cout<<"E,";

                           if(F==1) cout<<"F,"<<endl;

break;

}

return 0;

}



 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答

代码解释器

  评论区

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,e,f;
    for(a=0;a<=1;a++)
    {
    	for(b=0;b<=1;b++)
    {
    	for(c=0;c<=1;c++)
    {
    	for(d=0;d<=1;d++)
    {
    	for(e=0;e<=1;e++)
    {
    	for(f=0;f<=1;f++)
    {
    	 
    	 if((a+b) >= 1 && (a+d)!=2 && (a+e+f)==2 && (b+c!=1) && (d+c)==1 )
		 //条件化为数学知识 
    	 {
    	 	if(d==0)//最后一种情况分一下 好理解 
    	 	{
    	 		if(e==1)
    	 		break;
    	 		else
    	 		{
    	 			if(a==1)
    	 			cout<<"A,";
    	 			if(b==1)
    	 			cout<<"B,";
    	 			if(c==1)
    	 			cout<<"C,";
    	 			if(d==1)
    	 			cout<<
2023-05-17 15:36:30
  • «
  • 1
  • »