結果

問題 No.1824 門\松\列
ユーザー brthyyjp
提出日時 2022-01-28 21:39:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 280 bytes
コンパイル時間 582 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 66,688 KB
最終ジャッジ日時 2024-12-30 05:31:26
合計ジャッジ時間 1,418 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 4
権限があれば一括ダウンロードができます

ソースコード

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 = (n-1)*n*(2*n-1)//6-(n-1)*n//2
    ans += n*(n+1)*(2*n+1)//6-3*n*(n+1)//2+2*n
    print(ans)
0