| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
why wrong answer?Pls help me to get a right result.I see following program shows right result..but judge says wrong result...what is the problem?pls tell me.#include<iostream>
using namespace std;
int main()
{
long int a;
long int i = 2;
long int m = 2;
long int n = 2;
cin >> a;
if(i <= a)
{
while(i <= a)
{
if(m <= a)
{
if((m % a) == 0)
{
n = 1;
break;
}
}
else
{
break;
}
m = m + i;
++i;
}
if(n == 1)
{
cout << "YES" << endl;
}
else
{
cout << "NO" << endl;
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator