AT_arc224_b.Adjacent Tiles
普及-
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Let us place N square tiles of the same size on a plane so that they do not overlap.
Then, what is the maximum possible number of pairs of different tiles that share one full side?
Here, a pair of different tiles (a,b) is said to share one full side if and only if some side of a and some side of b coincide completely.
T test cases are given; solve each of them.
我们将在平面上放置 N 个相同大小的正方形瓷砖,且它们互不重叠。
那么,恰好共享一条完整边的不同瓷砖对的最大可能数量是多少?
这里,不同瓷砖对 (a,b) 被称为恰好共享一条完整边,当且仅当 a 的某条边与 b 的某条边完全重合。
共给出 T 个测试用例;请逐一求解。
输入格式
The input is given from Standard Input in the following format, where casei denotes the i-th test case:
T
case1
case2
⋮
caseT
Each test case is given in the following format:
N
输入从标准输入给出,格式如下,其中 casei 表示第 i 个测试用例:
T
case1
case2
⋮
caseT
每个测试用例的格式如下:
N
输出格式
Output T lines. The i-th line should contain the answer for the i-th test case.
输出 T 行。第 i 行应包含第 i 个测试用例的答案。
输入输出样例
输入#1
6 1 2 3 4 100000000000000000 1000000000000000000
输出#1
0 1 2 4 199999999367544467 1999999998000000000
说明/提示
Sample 1 Explanation:
This input contains six test cases.
The figure below shows an example of an optimal arrangement of tiles for N=1,2,3,4.
- For the first test case, N=1.
- There is no pair of different tiles sharing one full side.
- For the second test case, N=2.
- The pair of tiles (a,b) shares one full side.
- For the third test case, N=3.
- The pairs of tiles (a,b),(b,c) share one full side.
- For the fourth test case, N=4.
- The pairs of tiles (a,b),(a,c),(b,d),(c,d) share one full side.

Constraints
- 1≤T≤2×105
- 1≤N≤1018
- All input values are integers.
样例 1 解释:
该输入包含六个测试用例。
下图展示了 N=1,2,3,4 时瓷砖的最优排列示例。
- 对于第一个测试用例,N=1。
- 不存在任意两个不同的瓷砖共享一条完整边。
- 对于第二个测试用例,N=2。
- 瓷砖对 (a,b) 共享一条完整边。
- 对于第三个测试用例,N=3。
- 瓷砖对 (a,b),(b,c) 各自共享一条完整边。
- 对于第四个测试用例,N=4。
- 瓷砖对 (a,b),(a,c),(b,d),(c,d) 各自共享一条完整边。

约束条件
- 1≤T≤2×105
- 1≤N≤1018
- 所有输入值均为整数。
输入解题思路,AI测评打分。不知道怎么写?