头像
youyouli
发布于 03-31 22:12
+ 关注

求问

问一下,为什么循环里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;
}

}

全部评论

(0) 回帖
加载中...
话题 回帖

本文相关内容

等你来战

查看全部

热门推荐