求问

问一下,为什么循环里i和j从一开始不正确呢?

 #include<iostream>
using namespace std;
int  main(){
    int n;
    cin>>n;
    for(int i=2;i<n;i++){
        for(int j=2;j<n;j++){
            if(i+j==n){
                if(i%2==0&&j%2==0)cout<<"YES, you can divide the watermelon into two even parts."<<endl;
                return 0;
            }
           
        }
    }
    cout<<"NO, you can't divide the watermelon into two even parts."<<endl;
}

}

全部评论

相关推荐

2025-12-15 17:56
商洛学院 运维工程师
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务