Codeforces 776E 数论
来源:互联网 发布:微信网络出错1200 编辑:程序博客网 时间:2024/05/06 01:56
题意:求fk(n)%1000000007。
题解:
f(n)为欧拉函数
g(n)恒等于n
推荐看下大牛的证明QAQ
因为每走两步n都会取一次phi,所以可以直接暴力。
#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;typedef long long ll;ll phi(ll n){ ll ans=n,i; for(i=2;i*i<=n;i++){ if(n%i==0){ ans=ans-ans/i; while(n%i==0)n/=i; } } if(n>1)ans=ans-ans/n; return ans; } int main(){ll n,k;cin>>n>>k;while(k>0&&n>1){if(k%2==1)n=phi(n);k--;}cout<<n%1000000007<<endl;return 0;}
0 0
- Codeforces 776E 数论
- Codeforces 711E 数论
- codeforces 837E 数论
- Codeforces 893E 数论
- Codeforces 412E E-mail Addresses(数论)
- codeforces 446E E. Divisors(数论+暴力)
- Codeforces 776E The Holmes Children 【数论】【欧拉函数】
- codeforces 165E DP 数论 二进制
- codeforces #271E Three Horses 数论
- Codeforces Round #325 (Div. 2) E 数论
- Codeforces Round #395 (Div. 2) E(数论)
- CodeForces 448 E.Divisors(数论+递归)
- CodeForces 73 E.Morrowindows(数论)
- codeforces 337E E. Divisor Tree(数论+贪心)
- Codeforces Round #257 (Div. 2)E(数论+构造)
- Educational Codeforces Round 5 E. Sum of Remainders 数论
- Codeforces educational round 5. E Sum of Remainders 数论 分块
- 【数论】【分块】【乱搞】codeforces 616E Sum of Remainders
- 文件读取
- 第二周学习计划
- 转载:用图片搜索图片的几个好网站
- Fast R-CNN: Fast Region-based Convolutional Networks for object detection(阅读)
- ASP.NET MVC5+EF6+EasyUI 后台管理系统(82)-Easyui Datagrid批量操作(编辑,删除,添加)
- Codeforces 776E 数论
- 调侃
- android osmdroid 加载离线地图map格式以及地图网格绘制
- 人工智能标记语言AIML聊天机器人:产生、种类、应用、实例、AIML概述、知识库、公司、业界(20k字经典收藏版)
- codeforces 766 B
- BestCoder Round #92 第一次BC
- Hive 编译并提交Patch
- 最近 5 年 133 个 Java 面试问题列表(上)
- 回调函数