結果

問題 No.1824 門\松\列
ユーザー stngstng
提出日時 2022-05-14 16:51:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 541 ms / 2,000 ms
コード長 299 bytes
コンパイル時間 420 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 181,136 KB
最終ジャッジ日時 2023-09-30 08:41:53
合計ジャッジ時間 4,193 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 518 ms
180,576 KB
testcase_01 AC 515 ms
180,644 KB
testcase_02 AC 520 ms
180,736 KB
testcase_03 AC 541 ms
181,136 KB
testcase_04 AC 517 ms
180,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**7)

n = int(input())
t = [int(input()) for i in range(n)]
#print(t)

ans = [0]*(10**6+1)
ans[3] = 4

def dfs(x):
    if ans[x] != 0:
        return ans[x]
    ans[x] += dfs(x-1)+(x-1)*(x-2)*2
    return ans[x]

dfs(10**6)

for i in range(n):
    print(ans[t[i]])
0