結果

問題 No.846 メダル
ユーザー O2MT
提出日時 2020-09-23 18:51:37
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 428 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 80,128 KB
最終ジャッジ日時 2024-06-28 00:18:31
合計ジャッジ時間 4,255 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 4
other AC * 8 TLE * 1 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import ceil
P,Q,R = map(int,input().split())
A,B,C = map(int,input().split())

N1,N2 = P*(A-1),P*A
mi,ma = -1,-1
for n in range(N1,N2+1):
    if A == ceil(n/P) and B == ceil(n/Q)-A and C == ceil(n/R)-A-B:
        mi = n
        break
for n in range(N2,N1-1,-1):
   if A == ceil(n/P) and B == ceil(n/Q)-A and C == ceil(n/R)-A-B:
        ma = n
        break
if mi == -1 or ma == -1:
    print(-1)
else:
    print(mi,ma)
0