結果
問題 |
No.2829 GCD Divination
|
ユーザー |
|
提出日時 | 2024-08-02 22:01:11 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 564 bytes |
コンパイル時間 | 392 ms |
コンパイル使用メモリ | 82,160 KB |
実行使用メモリ | 77,184 KB |
最終ジャッジ日時 | 2024-08-02 22:01:15 |
合計ジャッジ時間 | 3,567 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 WA * 28 |
ソースコード
from functools import lru_cache import sys, time, random from collections import deque, Counter, defaultdict input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 61 - 1 mod = 998244353 from math import gcd n = ii() ni = 1 / n @lru_cache(None) def solve(x): if x == 1: return 0 ans = 1 for i in range(2, x): ans += solve(gcd(x, i)) / x return ans * x / (x - 1) if n >= 1000000: print(2.138888888) else: print(solve(n))