問題一覧 > 通常問題

No.2469 Umbrella Queries

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 43
作問者 : SPD_9X2 / テスター : akakimidori りあん tsutaj beet 👑 tute7627 nok0 👑 rin204 だれ momoyuu KKT89 Ayuna
お気に入りにしたユーザー ProblemId : 7095 / 自分の提出
問題文最終更新日: 2023-09-17 19:25:34
Umbrella Queries
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Show the original
Japan Alumni Group Summer Camp 2023 Day 2 (順位表) の他の問題:

Problem Statement

Micchan noticed that an umbrella looks like a regular polygon when viewed from above. She then created the following problem.

Umbrella Query

A regular $N$-gon has $N$ edges. It also has $\frac{N(N-1)}{2} - N$ diagonals. Consider the set of these $\frac{N(N-1)}{2}$ line segments in total.

How many pairs of $2$ line segments in this set satisfy both of the following $2$ conditions?

  • The $2$ line segments have a common endpoint. (That is, they share a point at a vertex of the $N$-gon.)
  • The $2$ line segments are perpendicular to each other.

Micchan has posed $T$ of the above problems. However, Micchan's friend cannot keep up with so many requests. On her behalf, find the answer to each problem.

Input

$T$
$N_1$
$N_2$
$\vdots$
$N_T$

  • All inputs are integers.
  • $1 \le T \le 10^5$
  • $3 \le N_i \le 10^9$

Output

Output the answers over $T$ lines.
On the $i$-th line, output the answer to the problem for $N = N_i$.
End each line with a newline.

Sample

Sample 1
Input
3
4
3
1000000000
Output
4
0
499999999000000000

Explanation of the first case: Count only the pairs of line segments that meet perpendicularly at a vertex of the regular $4$-gon.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。