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