結果
問題 |
No.2177 Recurring ab
|
ユーザー |
![]() |
提出日時 | 2024-12-02 18:43:49 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 53 ms / 2,000 ms |
コード長 | 502 bytes |
コンパイル時間 | 390 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 60,288 KB |
最終ジャッジ日時 | 2024-12-02 18:43:52 |
合計ジャッジ時間 | 2,768 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
import sys from itertools import permutations input = sys.stdin.readline n = int(input()) ans = 0 for a, b in permutations([*range(10)], 2): def func(p, a, b): return (p ** 2 < n * (p * a + b) + 1) min_p = max(a, b) + 1 if not(func(min_p, a, b)): continue ok = min_p ng = 10 ** 9 + 1 while(abs(ok - ng) > 1): mid = (ok + ng) // 2 if func(mid, a, b): ok = mid else: ng = mid ans += ok - min_p + 1 print(ans)