当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3181:Greatest Naruto Army

题目描述
Wyb is a VERY VERY BIG fans of Naruto(漩涡鸣人). Naruto's perseverance and passion attract him a lot, so does Naruto's skill "Kagebunsin no jyutu"(影分身术). Actually, wyb knows more details about "Kagebunsin no jyutu" than most of us. When Naruto makes an new illusion(幻象), his Chakra will divide into two parts A and B, and increase Naruto's weariness value by absolutely value of (A - B).
For example, at first Naruto have 5 Chakra, then he makes an illusion who has 2 Chakra. So he left 3 Chakra, and increase his weariness value by 1 (3 - 2). If he make a new illusion again and give him 2 Chakra, then he only left 1 Chakra and his weariness value changes to 2. Naruto cannot make a new illusion unless his Chakra is bigger than 1. What's more, Naruto's illusion can also use "Kagebunsin no jyutu" and the weariness they gains will also return to Naruto himself.

Now Naruto wants to make as many illusions as he can because Kakashi Sensei wants to teach him a new Ninjyutsu(忍术) and minimum his weariness value.
输入解释
The first line of input contains an integer T, indicating the number of test cases, then T lines follow , each line contains a positive integer N, indicating the number of Naruto's Chakra.
0 < N < 10000000;
输出解释
For each case ,output the minimum weariness value of Naruto when he makes the most illusions.
输入样例
2
5
9
输出样例
2
3
来自杭电HDUOJ的附加信息
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3181

最后修改于 2020-10-25T23:00:58+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)