結果

問題 No.2207 pCr検査
ユーザー 👑 tatyam
提出日時 2022-07-13 01:21:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 580 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 134,400 KB
最終ジャッジ日時 2024-07-02 18:42:50
合計ジャッジ時間 16,573 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 28 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
input = sys.stdin.readline

k = int(input())
N = [tuple(map(int, input().split())) for _ in range(k)]
lgN = sum(math.log(p) * e for p, e in N)
P = N[-1][0]
lg = 0.0
err = math.inf
R = -1
for i in range(P):
    lg += math.log(P - i) - math.log(i + 1)
    if err > abs(lg - lgN):
        err = abs(lg - lgN)
        R = i + 1

for p, e in N:
    def f(x):
        ans = 0
        while True:
            x //= p
            if x == 0:
                return ans
            ans += x
    if e != f(P) - f(P - R) - f(R):
        exit(print(-1, -1))

print(P, R)
0