问题标题: 1672

0
0

1
已采纳
杨陈卓
杨陈卓
新手天翼
新手天翼

    int a,b;

    cin>>a>>b;

    if((a%2==0&&a<=9&&a>=0)&&(b%2==0&&b<=6))

        cout<<"Yes"<<endl;

    if((a%2==1&&a<=9&&a>=0)&&(b%2==1&&b<=6))

        cout<<"Yes"<<endl;

    if(b==7)

        cout<<"Yes"<<endl;

    if((a%2==0)&&(b%2!=0&&b<=6))

        cout<<"No"<<endl;

    if((a%2==1)&&(b%2!=1&&b<=6))

        cout<<"No"<<endl;

 

1
陆麟瑞
陆麟瑞
资深天翼
资深天翼
if判断
if(b%2==1&&b!=7)//如果今天的星期数是奇数且不是7
    {
        if(a%2==0) cout<<"No";
        else cout<<"Yes";
    }
    else 
    if(b%2==0)//如果今天的星期数是偶数
    {
        if(a%2==1) cout<<"No";
        else cout<<"Yes";
    }
    else
    {
        cout<<"Yes";
    }

可供参考。

0
孙艺芳
孙艺芳
高级守护
高级守护
cin>>a>>b;//输入
    if(b%2==a%2||b==7) cout<<"Yes";
    else cout<<"No";//判断

 

0
谢其桦
谢其桦
资深守护
资深守护
{
        if(a%2==0) cout<<"No";
        else cout<<"Yes";
    }
    else 
0
0
孙天博
孙天博
新手守护
新手守护
int a,b;
    cin>>a>>b;
    if(b==7)
    cout<<"Yes";
    else
    {
    if(b%2==0)
    {
    if(a%2==0)
    cout<<"Yes";
    else
    cout<<"No";
    }
    else
    if(a%2!=0)
    cout<<"Yes";
    else
    cout<<"No";
    }
我要回答