CF1822C.Bun Lover

入门

通过率:0%

时间限制:3.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 nn, the length of the outer side of the square is nn, 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+1n + 1 is obtained from a cinnabon roll of size nn by wrapping each of the dough spirals around the cinnabon roll for another layer.

It is important that a cinnabon roll of size nn is defined in a unique way.

Tema is interested in how much chocolate is in his cinnabon roll of size nn. Since Tema has long stopped buying small cinnabon rolls, it is guaranteed that n≥4n \ge 4.

Answer this non-obvious question by calculating the total length of the chocolate layer.

特玛钟爱肉桂卷——一种形似“蜗牛”的、内含肉桂和巧克力的面包卷。

肉桂卷有多种尺寸,从正上方看呈正方形。肉桂卷中最美味的部分是巧克力,它以螺旋状薄层覆盖在肉桂卷表面,并环绕整个面包卷,如下图所示:

尺寸为 4、5、6 的肉桂卷

对于尺寸为 nn 的肉桂卷,其正方形外边长为 nn,且中心区域最短的垂直巧克力线段长度为 1。

形式化地,该面包卷由两条被巧克力分隔开的面团螺旋构成。尺寸为 n+1n + 1 的肉桂卷,可由尺寸为 nn 的肉桂卷将每条面团螺旋再向外缠绕一层而得到。

重要的是,尺寸为 nn 的肉桂卷具有唯一确定的结构。

特玛想知道他的尺寸为 nn 的肉桂卷中究竟含有多少巧克力。由于特玛早已不再购买小尺寸的肉桂卷,因此保证 n≥4n \ge 4。

请通过计算巧克力层的总长度,来回答这个并不显然的问题。

输入格式

The first line of the input contains a single integer tt (1≤t≤1051 \le t \le 10^5) — the number of test cases.

The following tt lines describe the test cases.

Each test case is described by a single integer nn (4≤n≤1094 \le n \le 10^9) — the size of the cinnabon roll.

输入的第一行包含一个整数 tt(1≤t≤1051 \le t \le 10^5)—— 表示测试用例的数量。

接下来的 tt 行描述了各个测试用例。

每个测试用例由一个整数 nn(4≤n≤1094 \le n \le 10^9)描述 —— 表示肉桂卷的尺寸。

输出格式

Output tt integers. The ii-th of them should be equal to the total length of the chocolate layer in the ii-th test case.

输出 tt 个整数。其中第 ii 个整数应等于第 ii 个测试用例中巧克力层的总长度。

输入输出样例

  • 输入#1

    4
    4
    5
    6
    179179179

    输出#1

    26
    37
    50
    32105178545472401

输入解题思路,AI测评打分。不知道怎么写?

首页