| ||||||||||
| 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 | |||||||||
为什么Runtine Error呢?看了半天,不明白!#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator