戒骄 戒躁 坚持 不懈
posts - 0, comments - 0, trackbacks - 0, articles - 1
  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

HEU 1008 Relatives

Posted on 2009-04-02 11:12 黑耗子 阅读(51) 评论(0)  编辑 收藏 引用
/**************************************
Problem: HEU 1008 Relatives
Time: 0.0080s
Memory: 236 k 
Accepted Time: 2009-03-21 21:28:24
Tips: 欧拉函数 
http://acm.hrbeu.edu.cn/forums/index.php?showtopic=2181&hl=1008 
*************************************
*/

#include 
<stdio.h>
int main()
{
long n,i;
while(scanf("%ld",&n),n!=0)
{
   
long sum=1;
   
for(i=2;;i++)
   
{
    
if(n%i==0)
    
{
     sum
*=i-1;
     n
/=i;
     
while(n%i==0)
     
{
      n
/=i;
      sum
*=i;
     }

    }

    
if(n==1)break;
   }

   printf(
"%ld\n",sum);
}

return 0;
}

 

只有注册用户登录后才能发表评论。
网站导航:   博客园   博客园最新博文   博问   管理