HBC52034日常诈骗签到题,欧拉函数,数学,数论Make Shan Happy题解

原来我爱你 算法基础篇 41 0
想要检验自己的编程水平?来试试全网最全C++题库,让您在挑战中不断进步。
Shan is a kind of fish and looks very beautiful in dress. There is a tree whose root is 1. Every node i in this tree owns a weight W[i]W[i] W[i], satisfying that ifxx x is an ancestor ofyy y then W[x]≤W[y]W[x] le W[y]W[x]≤W[y]. Shan have several questions, each question can be represented as a pair(x,k), Shan wants to find the biggest node y such that yk≤W[lca(x,y)]y - k le W[lca(x,y)]yk≤W[lca(x,y)]. Shan is not happy today, can you help her to answer these questions?

Shan is a kind of fish and looks very beautiful in dress. There is a tree whose root is 1. Every node i in this tree owns a weight W[i] W[i] W[i] , satisfying that if x x x  is an ancestor of y y y  then W[x]≤W[y]W[x] le W[y]W[x]≤W[y]. Shan have several questions, each question can be represented as a pair(x,k), Shan wants to find the biggest node y such that y−k≤W[lca(x,y)]y - k le W[lca(x,y)]y−k≤W[lca(x,y)]. Shan is not happy today, can you help her to answer these questions?

HBC52034日常诈骗签到题,欧拉函数,数学,数论Make Shan Happy题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断学习,不断挑战,才能在编程领域中脱颖而出!全网最全C++题库,助您成为编程高手!

标签: HBC52034日常诈骗签到题 欧拉函数 数学 数论Make Shan Happy题解