結果
問題 |
No.2177 Recurring ab
|
ユーザー |
![]() |
提出日時 | 2022-11-16 20:33:59 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 436 bytes |
コンパイル時間 | 155 ms |
コンパイル使用メモリ | 81,972 KB |
実行使用メモリ | 63,364 KB |
最終ジャッジ日時 | 2024-09-17 15:28:16 |
合計ジャッジ時間 | 1,884 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 14 WA * 4 |
ソースコード
# WA(?) import sys from itertools import permutations input = sys.stdin.readline n = int(input()) def check(p, a, b): return (p * a + b) / (p ** 2 - 1) > 1 / n ans = 0 for a, b in permutations([*range(10)], 2): min_p = max(a, b) + 1 if not(check(min_p, a, b)): continue ok = min_p ng = 10 ** 9 + 1 while(ng - ok > 1): p = (ok + ng) >> 1 if(check(p, a, b)): ok = p else: ng = p ans += ok - min_p + 1 print(ans)