codeforces 776E - The Holmes Children

intel-VROC raid卡驱动 centos7.9 u盘进入系统,按e,在出现下面在quiet前面输入inst.dd initcall_blacklist=vmd_drv_init 后按Ctrl和x,开始引导。进入系统,按e,在出现下面在quiet前面输入inst.dd inicll_blacklist=vmd_drv_init 后按Ctrl和x,开始引导。驱动完成后,在输入 c 回车, 引导过程开始,进入安装界面。输入1 ,选择这个ISO驱动文件里的rpm包。输入1 ,选择这个ISO驱动文件里的rpm包。vi编辑 /etc/default/grub。 阅读详情

Problem Description
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.

Input
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
Output a single integer — the value of Fk(n) modulo 1000000007.

Example
Input
7 1
Output
6
Input
10 2
Output
4
Note
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.

g(n):f(x)的和,n为x的倍数。eg:g(10)=f(1)+f(2)+f(5)
一系列代入发现g(n)=n;

将g(n)=n代入Fk(n),得Fk(n)=f(f(f…..f(n)…)其中嵌套的f为(k+1)/2层,
eg:F5(n)=f(f(f(n)));

f(n):任意的两个数x,y,满足x+y=n且x,y互为质数
假设 如果x和y不互质,那么设,x和y的共同因子为w,又因为n=x+y,所以可以提出公因子w,所以n和x,y都不互质;相反,如果x,y互质,则n与他们中的任意一个互质。所以只找满足与n互质的x 数量就可以了。
互质数的求法:http://blog.youkuaiyun.com/winter2121/article/details/78411647

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<math.h>
using namespace std;
typedef long long ll;
ll print(ll n){
    ll m=sqrt(n);
    ll x=n;
    for(ll i=2;i<=m&&i<=n;++i){
        if(n%i==0) x=x/i*(i-1);
        while(n%i==0){
            n/=i;
        }

    }
    if(n>1)
        x=x/n*(n-1);
    return x;
}
int main()
{
    ll n,k;
    cin>>n>>k;
    k=(k+1)/2;
    while(k--&&n>1){
        n=print(n);
    }
    cout<<n%1000000007<<endl;
    return 0;
}
地统计插值学习心得(一) (创建地统计图层工具用于根据现有的地统计图层或者地统计模型来创建包含新要素数据集的地统计图层,也就是使用构建好的地统计模型用到新的数据集中)这表明,远离极值的区域预测不受极值的影响,并且还表明,包括极值会导致钼元素浓度高的区域周围的预测明显变高。通常,我们使用同一个数据集进行建模和预测,但是在实际插值过程中,这两步的数据可以是不同的,这就是处理极值的诀窍。如果你的数据集有无法忽略的极值时(比如这些钼元素浓度),一种常见的方法是首先显式移除极值进行建模,然后在预测中使用整个数据集(包括极值)。 阅读详情

相关推荐

LVGL8.x 实体按键与Keypad驱动的无缝对接实战

本文详细解析了LVGL8.x中实体按键与Keypad驱动的两种对接方案:坐标映射的Button方式与事件驱动的Keypad方式。重点阐述了如何模块化裁剪lv_port_indev.c模板文件,并深入讲解了Keypad驱动与Group焦点管理系统的核心协作机制,为无触摸屏的嵌入式设备提供流畅的UI交互解决方案。

weixin_29164497的博客 446

求最大公约数Greatest Common Divisor(GCD)

#include using namespace std; int GCD(int a, int b) { int Remainder; while( b != 0 ) { Remainder = a % b; a = b; b = Remainder; } return a; } int main() { int x, y; cout > x; cout > y; cout

Laffrey的专栏 2584

别再浪费主板上的PCIE插槽了!手把手教你用VL805芯片打造高速USB3.0扩展坞

本文详细介绍了如何利用VL805芯片将主板闲置的PCIE插槽改造为高性能USB3.0扩展坞。从芯片选型、电路设计到焊接工艺和系统调试,提供了一套完整的实战指南,帮助用户充分释放硬件潜能,实现高达5Gbps的传输速度。

weixin_27134495的博客 326

sgu 499. Greatest Greatest Common Divisor 因数打表

499. Greatest Greatest Common DivisorTime limit per test: 0.5 second(s)Memory limit: 262144 kilobytesinput: standardoutput: standardAndrew has just made a breakthrough in sociology: he realized how to...

superkunn的博客 338

复现HumanMAC(HumanMAC: Masked Motion Completion for Human Motion Prediction)

Human3.6M和HumanEva-I都放到data目录下(记得将data_multi_modal-20250320T022408Z-001.zip和humaneva_multi_modal-20250320T022412Z-001.zip解压缩并且分别重命名为data_multi_modal和humaneva_multi_modal)。生成的gif存放在inference目录下zero_shot_<INDEX>下的out目录下。新建一个data目录,将

qq_52643100的博客 831

通俗地解释一下 EMD(经验模态分解,Empirical Mode Decomposition)

EMD 就像把一碗“混在一起的面条”分成不同粗细的面条,方便你逐层分析每种波动。

qlkaicx的博客 1249

Greatest Common Divisor (GCD) - Euclidean algorithm

The Euclidean algorithm calculates the greatest common divisor (GCD) of two natural numbers a and b. The greatest common divisor g is the largest natural number that divides both a and b without lea

screaming的博客 1669

kettle9.0+ 连接Hadoop报错

kettle bug

x²+(y-√³x²)²=1的博客 1559

Codeforces 776E: The Holmes Children (数论 欧拉函数)

题目链接 先看题目中给的函数f(n)和g(n)   对于f(n),若自然数对(x,y)满足 x+y=n,且gcd(x,y)=1,则这样的数对对数为f(n) 证明f(n)=phi(n) 设有命题 对任意自然数x满足x<n,gcd(x,n)=1等价于gcd(x,y)=1 成立,则该式显然成立,下面证明这个命题。 假设gcd(x,y)=1时,gcd(x,...

weixin_34337265的博客 190

GEE高阶应用——如何绘制2000-2022年土地利用变化轨迹时序图

土地利用变化是指在一定时间范围内,土地利用类型和结构发生的变化。时序变化是指这种变化随时间的推移而发生的序列变化。土地利用变化轨迹的时序变化具体介绍如下:首先,土地利用变化轨迹的时序变化体现在土地利用类型的演变上。在过去的几十年里,随着人口的增加、经济的发展和城市化的推进,土地利用类型发生了显著的变化。传统的农田逐渐减少,而城市、工业、交通、居住等用地的面积不断扩大。同时,随着环境保护意识的提高,生态保护用地、森林、湿地等绿色用地的面积也在增加。

此星光明博客 1113

【YOLOv8/v9/v10 实战 01】YOLOv8/v9/v10全系列实战对决:性能矩阵、架构拆解与2026部署指南

2026年YOLO生态已进入“战国时代”,Ultralytics YOLOv8/11/26、阿里YOLO12、清华YOLOv10、微软YOLOv9四大路线并行发展。本文基于官方文档、学术论文及实测数据,系统剖析三大核心版本(YOLOv8/v9/v10)的架构演进逻辑,构建覆盖参数量、mAP、FPS、FLOPs的完整性能矩阵。通过8组工业场景实测、全流程代码实现(训练-导出-部署)、6类硬件适配方案,解决新手选型难、进阶者优化无门、工业开发者部署低效的痛点。

专注于人工智能、软件开发、工控自动化、工厂数字化及智能化等领域,希望和大家共同进步! 533

【题解】codeforces776E The Holmes Children

题目链接 题意:定义函数f(n),f(1)=1,f(n)=|{(x,y)|x+y=n,x≥1,y≥1,gcd(x,y)=1}|(n>1)。定义函数g(n),g(n)=Σf(n/d)(求和对n的全体约数d进行)。递归地定义函数F_k(n),F_1(n)=f(g(n)),F_k(n)=g(F_k-1(n))(k>1且k为偶数),F_k(n)=f(F_k-1(n))(k>1且k为奇数)。求F_k(n)

ZJZ的博客 517

水很深的深度学习(四): 卷积神经网络CNN

深度学习-CNN,卷积神经网络的概念 上世纪60年代,Hubel等人通过对猫视觉皮层细胞的研究,提出了感受野这个概念,到80年代,Fukushima在感受野概念的基础之上提出了神经认知机的概念,可以看作是卷积神经网络的第一个实现网络,神经认知机将一个视觉模式分解成许多子模式(特征),然后进入分层递阶式相连的特征平面进行处理

专注大数据与人工智能技术分享,欢迎私信加群互相学习! 3622

codeforces 776E The Holmes Children

目录 codeforces 776E The Holmes Children 题意 题解 Code codeforces 776E The Holmes Children 题目传送门 题意 定义\(f(n)\)为满足\(x+y=n\)并且\(gcd(x,y)...

dieyi9889的博客 174

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

【codeforces 776E】The Holmes Children

【题目链接】:http://codeforces.com/contest/776/problem/E 【题意】 f(n)是小于n的不同整数对(x,y)这里x+y==n且gcd(x,y)==1的个数; g(n)是n的所有因子的f值的和; 然后让你求一个递推式 【题解】 x的欧拉函数为phi(x) 则f(n)=phi(n); 欧拉函数的定义是,小...

132

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

codeforces 776E - The Holmes Children

The Holmes children are fighting over who amongst them is the cleverest. Mycroft asked Sherlock and Eurus to find value off(n), wheref(1) = 1and forn ≥ 2,f(n)is the number of distinct ord

ShiWaiGaoRen12345的博客 1319

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

Codeforces 776E The Holmes Children

题目链接:http://codeforces.com/problemset/problem/776/E ${\because gcd(i,n-i)=1\Leftrightarrow gcd(i,n)=1}$ ${\therefore f(x)=\phi (x)}$ ${\because \sum_{d|x}\phi(d)=x}$ ${\therefore g(x)=x}$ 问题转换为...

weixin_30664051的博客 115

Codeforces 776E The Holmes Children 【数论】【欧拉函数】

题目链接:http://codeforces.com/contest/776/problem/E题意: 有三个函数 f(n) g(n) Fk(n),已知 n, k,求Fk(n)的值题解: 我们首先讨论 k=1 时的情况,此时我们的任务变成了求以下方程 x,y 的对数(对数就是 f(n)) 这个 x,y 的对数可以使用欧拉函数 phi() 来表示(证明略),结果为 phi

BlueSky 570

欧拉函数 codeforces 776E - The Holmes Children

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

雪的期许 1838

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 Sh

剑锋OI SharpSwordOI 407

Codeforces 776E 数论

The Holmes Children time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The Holmes children are fighting over w

black_miracle的博客 722

codeforces Round 400 E-The Holmes Children

#include using namespace std; typedef long long LL; const int M=1e9+7; const int N=1e6+10; int prime[N],h; void getprime() {     memset(prime,0,sizeof prime);     for (int i=2;i

MustImproved的博客 579

欧拉函数迭代与递归收敛:Codeforces 776E 数论难题解析

欧拉函数 φ(n) 是数论中的核心概念,用于计算小于等于 n 且与 n 互质的正整数个数。其计算基于质因数分解,公式为 φ(n) = n ∏(1 - 1/p)。在算法竞赛中,欧拉函数常与递归、迭代过程结合,考察对函数性质与收敛性的洞察。例如,由于 φ(n) ≤ n-1 且对偶数至少减半,连续迭代会快速收敛到不动点 1。这一性质可用于优化大规模递归计算,将指数级迭代降至常数次,在诸如 Codeforces 776E 等题目中,通过欧拉函数迭代与递归收敛分析,能高效解决 n 和 k 高达 10^12 的数论问题

weixin_33847182的博客 405

欧拉函数 codeforces 776E

776E题解 http://www.cnblogs.com/Just--Do--It/p/6437212.html 欧拉函数性质 http://www.cnblogs.com/exponent/archive/2011/08/09/2131960.html

ZT在努力 836
上一篇: Codeforces Round #400 (Div. 1 + Div. 2, combined)D - The Door Problem(2-sat)
下一篇: uva583 Prime Factors
Seeyouer
博客等级 码龄9年 16粉丝 43原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值