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

来个超时的代码吧

Posted by z1160y at 2009-06-09 12:21:27 on Problem 1183
#include <iostream>
using namespace std;
int main()
{
	unsigned long a;
	while(cin>>a)
	{
		unsigned long b,c,sum=10000000000000000000;
		for(b=a+1;b<=a*a+a+1;b++)
		{
			if((a*b+1)%(b-a)==0)
			{
				c=(a*b+1)/(b-a);
				if(sum>(b+c))  sum=b+c;
			}
		}
		cout<<sum<<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