結果

問題 No.1824 門\松\列
ユーザー brthyyjpbrthyyjp
提出日時 2022-01-28 21:36:02
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 387 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 86,892 KB
実行使用メモリ 80,280 KB
最終ジャッジ日時 2023-08-28 19:20:41
合計ジャッジ時間 4,056 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
80,280 KB
testcase_01 AC 78 ms
75,460 KB
testcase_02 AC 81 ms
76,696 KB
testcase_03 TLE -
testcase_04 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import io, os
input = sys.stdin.buffer.readline
#input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

t = int(input())
for _ in range(t):
    n = int(input())
    ans = 0
    for i in range(n-1, 0, -1):
        #print(i, (n-i)*(n-i-1))
        ans += (n-i)*(n-i-1)
    for i in range(n, 1, -1):
        #print(i, (i-1)*(i-2))
        ans += (i-1)*(i-2)
    print(ans)
0