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

求助(Time Limit Exceed)

Posted by zhaohuazhaoshi at 2005-04-23 17:32:22 on Problem 2407
#include<iostream.h>
#include<math.h>
void main()
{
	long a,i,j,p=0,b;	
	while(1)
	{
		cin>>a;
		if(a==0)
			break;
		else
		{
			b=int(sqrt(a));
			//cout<<b;
			for(i=2;i<a;i++)
				for(j=2;j<=b;j++)
				{
					if(a%j==0&&i%j==0)
					{
						//cout<<i<<' '<<j<<endl;
						p++;
						break;
					}
				}
			cout<<a-p-1<<endl;
			p=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