Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

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.

Posted by 05310007 at 2007-11-04 13:14:30 on Problem 3372
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator