結果
問題 |
No.2973 シュニレルマン積分入門
|
ユーザー |
![]() |
提出日時 | 2024-11-29 22:34:23 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 392 bytes |
コンパイル時間 | 318 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,520 KB |
最終ジャッジ日時 | 2024-11-29 22:34:43 |
合計ジャッジ時間 | 6,057 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 WA * 29 |
ソースコード
import fractions from functools import lru_cache N=int(input()) @lru_cache(maxsize=None) def A(N): if N==0: return fractions.Fraction(1) if N==1: return fractions.Fraction(1) if N>0: return A(N-1)-10*A(N-2) else: return (A(N+1)-A(N+2))/10 ans=-A(N-2) n,d=ans.numerator,ans.denominator if N>0: n=abs(n) else: d=-abs(d) print(n,d,sep="/")