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:贴代码,28行。

Posted by 141220004 at 2015-11-24 20:21:15 on Problem 2407
In Reply To:贴代码,28行。 Posted by:139074241 at 2015-02-23 14:57:00
> #include<iostream>
> using namespace std;
> int main()
> {
> 	int n,ans,i;
> 	while(cin>>n&&n)
> 	{
> 		if(n==1)
> 		{
> 			cout<<0<<endl;
> 			continue;
> 		}
> 		ans=n;
> 		for(i=2;i*i<=n;++i)
> 			if(n%i==0)
> 			{
> 				ans-=ans/i;
> 				while(n%i==0)
> 					n/=i;
> 			}
> 		if(n!=1)
> 			ans-=ans/n;
> 		cout<<ans<<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