Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
大水题#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator