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

为什么Runtine Error呢?看了半天,不明白!

Posted by hubo430 at 2006-07-15 13:33:31 on Problem 2407
#include<iostream.h>
int main()
{
	int n;
	while(cin>>n)
	{
		if(!n) break;
		int a[300000]={0},k=n,i,t=n;
		for(i=2;i*i<=k;i++)
		{
			if(k%i!=0) continue;
			a[i]++;
			k/=i;
			i=1;
		}
		if(k!=1&&a[k]==0) n=n/k*(k-1);
		for(i=2;i*i<=t;i++)
			if(a[i]) n=n/i*(i-1);
		cout<<n<<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