Codeforces Round #400 (Div. 1 + Div. 2, combined) 776E. The Holmes Children(待翻译)
Codeforces Round #241 (Div. 2) 514C Watto and Mechanism
≤,≠,≥<>
时间限制:1S / 空间限制:256MB
【在线测试提交传送门】
【问题描述】
The Holmes children are fighting over who amongst them is the cleverest.
Mycroft asked Sherlock and Eurus to find value of f(n), where f(1) = 1 and for n ≥ 2, f(n) is the number of distinct ordered positive integer pairs (x, y) that satisfy x + y = n and gcd(x, y) = 1. The integer gcd(a, b) is the greatest common divisor of a and b.
Sherlock said that solving this was child’s play and asked Mycroft to instead get the value of
.
Summation is done over all positive integers d that divide n.
Eurus was quietly observing all this and finally came up with her problem to astonish both Sherlock and Mycroft.
She defined a k-composite function Fk(n) recursively as follows:
She wants them to tell the value of Fk(n) modulo 1000000007.
【输入格式】
A single line of input contains two space separated integers n (1 ≤ n ≤ 1012) and k (1 ≤ k ≤ 1012) indicating that Eurus asks Sherlock and Mycroft to find the value of Fk(n) modulo 1000000007.
【输出格式】
Output a single integer — the value of Fk(n) modulo 1000000007.
【输入样例1】
7 1
【输出样例1】
6
【输入样例2】
10 2
【输出样例2】
4
【样例说明】
In the first case, there are 6 distinct ordered pairs (1, 6), (2, 5), (3, 4), (4, 3), (5, 2) and (6, 1) satisfying x + y = 7 and gcd(x, y) = 1. Hence, f(7) = 6. So, F1(7) = f(g(7)) = f(f(7) + f(1)) = f(6 + 1) = f(7) = 6.
慎入:以下为解题思路和参考代码,请务必先自行思考!
【解题思路】
【参考代码】
Codeforces Round #400 (Div. 1 + Div. 2, combined) 776E. The Holmes Children(待翻译)相关推荐
- Educational Codeforces Round 114 (Rated for Div. 2) (A ~ F)全题解
整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 Educational Codeforces Round 114 (Rated for Div. 2) ...
- Educational Codeforces Round 106 (Rated for Div. 2)(A ~ E)题解(每日训练 Day.16 )
整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 Educational Codeforces Round 106 (Rated for Div. ...
- Educational Codeforces Round 37 (Rated for Div. 2) 1
Educational Codeforces Round 37 (Rated for Div. 2) A.Water The Garden 题意:Max想给花园浇水.花园可被视为长度为n的花园床,花园 ...
- Educational Codeforces Round 90 (Rated for Div. 2)(A, B, C, D, E)
Educational Codeforces Round 90 (Rated for Div. 2) Donut Shops 思路 分三种情况: a==c/ba == c / ba==c/b这个时候两 ...
- Educational Codeforces Round 89 (Rated for Div. 2)(A, B, C, D)
Educational Codeforces Round 89 (Rated for Div. 2) A. Shovels and Swords 思路 题意非常简单,就是得到最多的物品嘛,我们假定a, ...
- Educational Codeforces Round 114 (Rated for Div. 2) D. The Strongest Build 暴力 + bfs
传送门 文章目录 题意: 思路: 题意: 你有nnn个装备槽,每个槽里面有cic_ici个力量加成,对于每个槽只能选一个力量加成,现在给你mmm个力量组合[b1,b2,...,bn][b_1,b_2 ...
- Educational Codeforces Round 72 (Rated for Div. 2) D. Coloring Edges dfs树/拓扑找环
传送门 文章目录 题意: 思路: 题意: 给你一张图,你需要给这个图的边染色,保证如果有环那么这个环内边的颜色不全相同,输出染色方案和用的颜色个数. n,m≤5e3n,m\le5e3n,m≤5e3 思 ...
- Educational Codeforces Round 111 (Rated for Div. 2) D. Excellent Arrays 组合数学
传送门 文章目录 题意: 思路: 题意: 给你一个数组aia_iai,定义一个数组是好的当且仅当对于所有iii都有ai!=ia_i!=iai!=i.定义f(a)f(a)f(a)表示数组aaa中i& ...
- Educational Codeforces Round 111 (Rated for Div. 2) E. Stringforces 二分 + 状压dp
传送门 文章目录 题意: 思路: 题意: 给你一个串,只包含前kkk个字母和???,定义fif_ifi表示第iii个字母在串中出现的最长连续长度,你现在需要将???替换为前kkk个字母,使得mini ...
最新文章
- 为什么有些老板要注册很多家公司
- das,nas,san区别——大型数据中心会用NAS+SAN软硬结合思路
- EntityManager:seam新手必读(二)
- numpy.random.normal
- UVA - 101:The Blocks Problem
- 一篇文章带你熟悉 TCP/IP 协议(网络协议篇二)
- jQuery本身方法($.each,$.map,$.contains,$ajax)
- mysql in 文本_MySQL_mysql 的load data infile,LOAD DATA INFILE语句从一个文本文 - phpStudy...
- 避免服务器成为肉鸡的应对措施
- Powershell下设置环境变量
- Java核心技术卷1:基础知识(原书第10版)
- 破解中兴ZXV10 H108L电信猫超级密码,附赠破解路由限制
- 曲面映射的算法理论基础
- 使用极光推送(www.jpush.cn)向安卓手机推送消息【服务端向客户端主送推送】C#语言...
- UnwindSegue
- 时空超分辨论文阅读笔记(一)---- Zooming Slow-Mo
- 【学生管理系统】班级管理
- signal()函数介绍
- IDM 下载器 使用记录
- 关于Spring5.3之后StringUtils.isEmpty被弃用
热门文章
- 淘宝店铺订单插旗接口(taobao.trade.memo.update淘宝店铺订单交易备注修改接口)代码对接教程
- PMP 考试工具技术常见翻译问题
- 完成A轮融资,倍思如何发力场景化为品牌创造广阔未来?
- db migrate mysql_DB Migrate那点事
- servlet获取post请求参数的方法
- android invoke 参数,如何使用Invoke传递接口回调参数
- 2006世界杯球员名单全部出炉 32支球队
- Office之EXCEL
- 随机拉丁方阵(Random Latin squares)
- 腾讯新闻每日热点爬取,WebMagic,Java爬虫