代码:

 #include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cctype>
#include <vector>
using namespace std; #define LL long long
#define res register long long
inline LL read()
{
LL x(),f(); char ch;
while(!isdigit(ch=getchar())) if(ch=='-') f=-;
while(isdigit(ch)) x=x*+ch-'',ch=getchar();
return f*x;
}
LL s[],tot;
LL b[],cnt;
inline void pre_work(LL n)
{
//质因数
LL tmp=n;
for(res i= ; i*i<=n ; i++)
{
if(n%i==) s[++tot]=i;
while(n%i==) n/=i;
}
if(n>) s[++tot]=n;
//约数
for(res i= ; i*i<=tmp ; i++)
if(tmp%i==)
{
b[++cnt]=i;
if(i!=tmp/i) b[++cnt]=tmp/i;
}
} LL phi(LL n)
{
LL ans=n;
for(res i= ; i<=tot ; i++)
{
if(n%s[i]==)
ans=ans/s[i]*(s[i]-);
}
return ans;
} int main()
{
// freopen("gcd.in","r",stdin);
// freopen("gcd.out","w",stdout);
LL n;
n=read();
pre_work(n);
sort(b+,b+cnt+);
for(res i= ; i<=cnt ; i++)
{
cout<<b[i]<<" ";
cout<<phi(n/b[i])<<endl;
}
return ;
}

最新文章

  1. 控制Storyboard播放zz
  2. Nand Flash,Nor Flash,CFI Flash,SPI Flash 之间的关系
  3. Oracle10g在Win2008R2下因版本无法安装问题的解决
  4. XP共享连接数限制
  5. Swift实战-QQ在线音乐(第二版)
  6. Server.Transfer和Response.Redirect区别
  7. Android 显示原理简介
  8. Oracle数据库还原方法
  9. c# base和this在构造函数中的应用
  10. thinkphp之获取客户端IP地址
  11. Swift中集合类型indexOf(Element)提示错误的解决办法
  12. 【LUOGU???】WD与积木 NTT
  13. Gin框架源码解析
  14. python下载及安装
  15. python中requests已安装却仍报No module named requests错的原因
  16. shell脚本的基本结构以及如何执行
  17. Nodejs【单机】多进程模式集群
  18. [转载]oracle的常用函数 instr() 和substr()函数
  19. Final阶段贡献分配规则及实施
  20. Unused Method(不再使用的方法)——Dead Code(死亡代码)

热门文章

  1. 76-Relatives-欧拉函数
  2. Openssl ec命令
  3. python 多继承详解-乾颐堂
  4. linux环境下搭建osm_web服务器四(对万国语的地名进行翻译和检索):
  5. Red Hat 6.5 Samba服务器的搭建(登录访问)
  6. [SoapUI] 比较两个不同环境下XML格式的Response, 结果不同时设置Test Step的执行状态为失败
  7. log4j-over-slf4j工作原理详解
  8. Golang 之 Qrcode 二维码
  9. Mac os安装DVWA环境教程
  10. [GO]runtime包及gosched的使用