Magical Sticks

这篇博客讨论了一道数学问题,关于企鹅Rocher如何通过连接不同长度的棍子来最大化拥有相同长度棍子的数量。题目描述中,每根棍子都有唯一的长度,通过连接两根棍子可以得到一根更长的新棍子。关键在于确定在不同的棍子数量(n)下,可以得到多少根相同长度的棍子。解题思路分析了当n为奇数和偶数时的情况,并给出最终简化后的解决方案。AC代码是这个问题的正确解答实现。
摘要由CSDN通过智能技术生成

1.题目:

A penguin Rocher has nn sticks. He has exactly one stick with length ii for all 1≤i≤n1≤i≤n.

He can connect some sticks. If he connects two sticks that have lengths aa and bb, he gets one stick with length a+ba+b. Two sticks, that were used in the operation disappear from his set and the new connected stick appears in his set and can be used for the next connections.

He wants to create the maximum number of sticks that have the same length. It is not necessary to make all sticks have the same length, some sticks can have the other length. How many sticks with the equal length he can create?

Input

The input consists of multiple test cases. The first line contains a single integer t (1≤t≤10001≤t≤1000) — the number of test cases. Next tt lines contain descriptions of test cases.

For each test case, the only line contains a single integer n (1≤n≤1091≤n≤109).

Output

 

For each test case, print a s

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值