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 13408100238 at 2014-08-01 19:11:35 on Problem 2407
#include"iostream"
#include"cstdio"
using namespace std;
void solve(int n)
{
	int tmp=n;
	for(int i=2;i*i<=n;i++)
		if(n%i==0)
		{
			tmp=tmp/i*(i-1);
			while(n%i==0)
				n/=i;
		}
	if(n>1)
		tmp=tmp/n*(n-1);
	cout<<tmp<<endl;
	return ;
}
int main()
{
	int n;
	while(cin>>n,n)
		solve(n);
	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