HBC15868Magic Forest题解

爱的那么颓废 算法基础篇 34 0
题库丰富多样,涵盖各个领域,全网最全C++题库,让您在练习中不断成长!
It’s universally acknowledged that there’re innumerable trees in the campus of HUST. One day you find an endless forest consisting of magic trees. The forest can be described in such a strange way: initially you know N trees with the magic power a1,…,an. Then for every (i,j) one tree with the magic power ai-aj and one tree with the magic power ai+aj will appear in the forest, then you know there will be 3N trees with the magic power a1,…,a3n. This process can be done repeatedly,so you know that the infinite forest contains innumerable trees. What you want to know is if there’s a tree with the magic power X.

It’s universally acknowledged that there’re innumerable trees in the campus of HUST. One day you find an endless forest consisting of magic trees. The forest can be described in such a strange way: initially you know N trees with the magic power a1,…,an. Then for every (i,j) (i can be equal to j) one tree with the magic power ai-aj and one tree with the magic power ai+aj will appear in the forest, then you know there will be 3N trees with the magic power a1,…,a3na_1,…,a_{3n}a1​,…,a3n​. This process can be done repeatedly, so you know that the infinite forest contains innumerable trees. What you want to know is if there’s a tree with the magic power X.

HBC15868Magic Forest题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
成为编程大师,不再是梦想!全网最全C++题库,助您开启编程新篇章。

标签: HBC15868Magic Forest题解