|  | 
|  | 
| back to board | Test #10 Posted by levani  22 Jul 2014 04:03I 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;
 
 }
 | 
 | 
|