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

Re:要注意1是DEFICIENT

Posted by 382784268 at 2009-02-17 09:51:16 on Problem 1528
In Reply To:要注意1是DEFICIENT Posted by:382784268 at 2009-02-17 09:50:43
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
	int p[101];
	int i,j;
	for(i=0;i<101;i++)
	{
		cin>>p[i];
		if(p[i]==0)
			break;
	}
	cout<<"PERFECTION OUTPUT"<<endl;
	j=0;
	while(j<i)
	{
		int s=0;
		for(int k=1;k<=p[j]/2;k++)
			if(p[j]%k==0)
				s+=k;
			if(s>p[j])
				cout<<setw(5)<<p[j]<<"  ABUNDANT"<<endl;
			if(s==p[j])
				cout<<setw(5)<<p[j]<<"  PERFECT"<<endl;
			if(s<p[j])
				cout<<setw(5)<<p[j]<<"  DEFICIENT"<<endl;
			j++;
	}
	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