A15933 | Bun Lover
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Tema loves cinnabon rolls — buns with cinnabon and chocolate in the shape of a "snail".
Cinnabon rolls come in different sizes and are square when viewed from above. The most delicious part of a roll is the chocolate, which is poured in a thin layer over the cinnabon roll in the form of a spiral and around the bun, as in the following picture:
 Cinnabon rolls of sizes 4, 5, 6
For a cinnabon roll of size $n$ , the length of the outer side of the square is $n$ , and the length of the shortest vertical chocolate segment in the central part is one.
Formally, the bun consists of two dough spirals separated by chocolate. A cinnabon roll of size $n + 1$ is obtained from a cinnabon roll of size $n$ by wrapping each of the dough spirals around the cinnabon roll for another layer.
It is important that a cinnabon roll of size $n$ is defined in a unique way.
Tema is interested in how much chocolate is in his cinnabon roll of size $n$ . Since Tema has long stopped buying small cinnabon rolls, it is guaranteed that $n \ge 4$ .
Answer this non-obvious question by calculating the total length of the chocolate layer.
Cinnabon rolls come in different sizes and are square when viewed from above. The most delicious part of a roll is the chocolate, which is poured in a thin layer over the cinnabon roll in the form of a spiral and around the bun, as in the following picture:
 Cinnabon rolls of sizes 4, 5, 6
For a cinnabon roll of size $n$ , the length of the outer side of the square is $n$ , and the length of the shortest vertical chocolate segment in the central part is one.
Formally, the bun consists of two dough spirals separated by chocolate. A cinnabon roll of size $n + 1$ is obtained from a cinnabon roll of size $n$ by wrapping each of the dough spirals around the cinnabon roll for another layer.
It is important that a cinnabon roll of size $n$ is defined in a unique way.
Tema is interested in how much chocolate is in his cinnabon roll of size $n$ . Since Tema has long stopped buying small cinnabon rolls, it is guaranteed that $n \ge 4$ .
Answer this non-obvious question by calculating the total length of the chocolate layer.
输入格式
The first line of the input contains a single integer $t$ ( $1 \le t \le 10^5$ ) — the number of test cases.
The following $t$ lines describe the test cases.
Each test case is described by a single integer $n$ ( $4 \le n \le 10^9$ ) — the size of the cinnabon roll.
The following $t$ lines describe the test cases.
Each test case is described by a single integer $n$ ( $4 \le n \le 10^9$ ) — the size of the cinnabon roll.
输出格式
Output $t$ integers. The $i$ -th of them should be equal to the total length of the chocolate layer in the $i$ -th test case.
输入输出样例
输入 #1
4 4 5 6 179179179
输出 #1
26 37 50 32105178545472401
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted