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

好吧, 新手我对齐对了好久,终于对齐了,1ac,0ms,呵呵

Posted by TSERROF at 2012-09-07 10:53:20 on Problem 1528
#include <iomanip>
#include <iostream>
using namespace std;
int main()
{
	int n;
	cout<<"PERFECTION OUTPUT"<<endl;
	while(cin>>n)
	{
		if(n==0){cout<<"END OF OUTPUT"<<endl;break;}
		if(n==1){cout<<setw(5)<<1<<"  DEFICIENT"<<endl;continue;}
		int stop=n,sum=1;
		for(int i=2;i<=n && i<stop;++i)
		{
			if(n%i)continue;
			stop=n/i;
			sum+=i+stop;
		}
		if(sum==n)cout<<setw(5)<<n<<"  "<<"PERFECT"<<endl;
		else if(sum<n)cout<<setw(5)<<n<<"  "<<"DEFICIENT"<<endl;
		else cout<<setw(5)<<n<<"  "<<"ABUNDANT"<<endl;
	}
	system("pause");
	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