結果

問題 No.1824 門\松\列
ユーザー stng
提出日時 2022-05-14 17:02:44
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 415 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 159,004 KB
最終ジャッジ日時 2024-07-23 02:59:05
合計ジャッジ時間 4,261 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 2 TLE * 1 -- * 1
権限があれば一括ダウンロードができます

ソースコード

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