結果

問題 No.2973 シュニレルマン積分入門
ユーザー vwxyz
提出日時 2024-12-03 21:34:57
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 430 bytes
コンパイル時間 1,323 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-12-03 21:35:04
合計ジャッジ時間 6,543 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

import fractions
from functools import lru_cache
@lru_cache(maxsize=None)
def solve(N):
    if N==0:
        return fractions.Fraction(1,10)
    if N==1:
        return fractions.Fraction(0)
    if N==2:
        return solve(N-1)+10*solve(N-2)+1
    if N>0:
        return solve(N-1)+10*solve(N-2)+1
    if N<0:
        return (-solve(N+1)-solve(N+2))/10
N=int(input())
ans=solve(N)
print(ans.numerator,"/",ans.denominator,sep="")
0