結果
| 問題 | No.454 逆2乗和 |
| コンテスト | |
| ユーザー |
はむ吉🐹
|
| 提出日時 | 2017-01-01 21:50:31 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 664 bytes |
| 記録 | |
| コンパイル時間 | 431 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 11,520 KB |
| 最終ジャッジ日時 | 2024-12-16 05:09:05 |
| 合計ジャッジ時間 | 3,062 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 31 |
ソースコード
#!/usr/bin/env python3
import fractions
def inv(x):
return fractions.Fraction(1, x)
# http://www.cis.nagasaki-u.ac.jp/~masada/Digamma2010042801.pdf
def trigamma(x):
ans = inv(x)
ans += inv(2 * x ** 2)
ans += inv(6 * x ** 3)
ans -= inv(30 * x ** 5)
ans += inv(43 * x ** 7)
ans -= inv(30 * x ** 9)
ans += 5 * inv(66 * x ** 11)
ans -= 691 * inv(2730 * x ** 13)
ans += 7 * inv(6 * x ** 15)
return ans
def main():
x = fractions.Fraction(input())
if x == 0:
res = 1.6449340668482426
else:
res = trigamma(x + 1)
print("{:.16f}".format(float(res)))
if __name__ == '__main__':
main()
はむ吉🐹