2026牛客国庆集训派对day7
F
Good Tree
牛客竞赛
未评级
原题
← EG →

Good Tree官方中文

题目描述

官方中文

Given a tree where all edge weights are $1$, define $f(u)=\sum_v dis(u,v)$, where $v$ represents all nodes in the tree, and $dis(u,v)$ is the length of the simple path between node $u$ and node $v$. A tree is called “good” if there exist two nodes $u$ and $v$ such that $f(u)-f(v)=x$. Given integer $x$, determine the minimum number of nodes required for the tree to be “good”.官方中文

输入格式

官方中文

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \leq t \leq 10^5$). The description of the test cases follows. Each test case contains an integer $x(1\le x\le 10^{18})$, representing the value for which you need to determine the minimum number of nodes required for the tree to be “good”.官方中文

输出格式

官方中文

For each test case, output a single integer, representing the minimum number of nodes required for the tree to be “good”.

It can be shown that the answer always exists.
官方中文

样例

Input #1
3
2
3
114514
Output #1
4
5
678
题目信息
题号
nc140735pf
时间限制
2 s
内存限制
256 MB

题面与样例版权归 牛客竞赛 及出题人所有;中文翻译由 AI 生成(官方原文),如有出入请以原文为准。