結果

問題 No.846 メダル
ユーザー TANIGUCHI KousukeTANIGUCHI Kousuke
提出日時 2019-11-07 13:17:50
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 401 bytes
コンパイル時間 46 ms
コンパイル使用メモリ 11,568 KB
実行使用メモリ 15,388 KB
最終ジャッジ日時 2023-10-13 02:57:24
合計ジャッジ時間 3,356 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 79 ms
15,104 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 80 ms
15,064 KB
testcase_05 AC 80 ms
15,144 KB
testcase_06 AC 79 ms
15,248 KB
testcase_07 AC 80 ms
15,320 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 82 ms
15,284 KB
testcase_23 AC 79 ms
15,304 KB
testcase_24 AC 80 ms
15,112 KB
testcase_25 AC 80 ms
15,304 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

P, Q, R = gets.split.map(&:to_i)
A, B, C = gets.split.map(&:to_i)
n0 = (1 .. (1 << 40)).bsearch do |n|
  a = (n + P - 1) / P
  b = (n + Q - 1) / Q - a
  c = (n + R - 1) / R - (a + b)
  a >= A && b >= B && c >= C
end
n1 = (1 .. (1 << 40)).bsearch do |n|
  a = (n + P - 1) / P
  b = (n + Q - 1) / Q - a
  c = (n + R - 1) / R - (a + b)
  a > A || b > B || c > C
end
puts n0 < n1 ? "#{n0} #{n1 - 1}" : -1
0