結果

問題 No.1824 門\松\列
ユーザー stngstng
提出日時 2022-05-14 17:02:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 415 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 10,628 KB
実行使用メモリ 148,876 KB
最終ジャッジ日時 2023-09-30 08:53:23
合計ジャッジ時間 4,297 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,964 KB
testcase_01 AC 372 ms
148,876 KB
testcase_02 AC 134 ms
8,388 KB
testcase_03 TLE -
testcase_04 -- -
権限があれば一括ダウンロードができます

ソースコード

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

#from functools import lru_cache
#@lru_cache(maxsize=10**6+1)
def dfs(x):
    #if ans[x] != 0:
    #    return ans[x]
    if x == 3:
        return 4
    #ans[x] += 
    return dfs(x-1)+(x-1)*(x-2)*2

#dfs(10**6)

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