結果
| 問題 |
No.2973 シュニレルマン積分入門
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2024-12-03 21:35:49 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 43 ms / 2,000 ms |
| コード長 | 429 bytes |
| コンパイル時間 | 211 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 11,392 KB |
| 最終ジャッジ日時 | 2024-12-03 21:35:53 |
| 合計ジャッジ時間 | 2,908 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
ソースコード
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 1-solve(N-1)-10*solve(N-2)
if N>0:
return -solve(N-1)-10*solve(N-2)
if N<0:
return (-solve(N+1)-solve(N+2))/10
N=int(input())
ans=solve(N)
print(ans.numerator,"/",ans.denominator,sep="")
vwxyz