結果
問題 | No.1824 門\松\列 |
ユーザー | brthyyjp |
提出日時 | 2022-01-28 21:39:11 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 83 ms / 2,000 ms |
コード長 | 280 bytes |
コンパイル時間 | 456 ms |
コンパイル使用メモリ | 86,904 KB |
実行使用メモリ | 76,472 KB |
最終ジャッジ日時 | 2023-08-28 19:24:48 |
合計ジャッジ時間 | 1,360 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 68 ms
71,152 KB |
testcase_01 | AC | 68 ms
71,344 KB |
testcase_02 | AC | 77 ms
75,044 KB |
testcase_03 | AC | 83 ms
76,472 KB |
testcase_04 | AC | 76 ms
75,044 KB |
ソースコード
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)