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

为什么老wa,很无语啊!!求高手指教(贴代码)

Posted by jean890915 at 2011-10-09 20:37:21 on Problem 1528
#include "iostream"
#include "math.h"
using namespace std;

int main()
{
	int i,n,sum;
	
	cin>>n;
	cout<<"PERFECTION OUTPUT"<<endl;
	while (n!=0)
	{
		sum = 0;
		for (i=2;i<=(int)sqrt(1.0*n);i++)
		{
			if (n%i == 0)
			{
				sum += i;
				if (i != n/i)
					sum += n/i;
			}
		}
		if (n!=1)
			sum += 1;
		if (sum == n)
			printf("%5d  PREEFCT\n",n);
		else if (sum < n)
			printf("%5d  DEFICIENT\n",n);
		else
			printf("%5d  ABUNDANT\n",n);
		cin>>n;
	}
	cout<<"END OF OUTPUT"<<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