|
|
back to boardI got WA 10, where is wrong? /////////////////////// #include <iostream> using namespace std; int main() { int N,M,sum,counter,mul; counter=0; cin>>N>>M; sum=M; mul=N*M; while(sum!=mul) { N--; sum+=N; counter++; if(sum==mul) break; M--; sum+=M; counter++; } cout<<counter<<endl; } |
|
|