結果

問題 No.920 あかあお
ユーザー simansiman
提出日時 2020-03-18 18:02:54
言語 Ruby
(3.3.0)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 256 bytes
コンパイル時間 225 ms
コンパイル使用メモリ 11,264 KB
実行使用メモリ 15,332 KB
最終ジャッジ日時 2023-08-20 20:07:09
合計ジャッジ時間 2,781 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
15,320 KB
testcase_01 AC 66 ms
15,068 KB
testcase_02 AC 64 ms
15,160 KB
testcase_03 AC 64 ms
15,248 KB
testcase_04 AC 65 ms
15,228 KB
testcase_05 AC 64 ms
15,276 KB
testcase_06 AC 64 ms
15,332 KB
testcase_07 AC 67 ms
15,160 KB
testcase_08 AC 67 ms
15,180 KB
testcase_09 AC 66 ms
15,072 KB
testcase_10 AC 68 ms
15,304 KB
testcase_11 AC 65 ms
15,088 KB
testcase_12 AC 65 ms
15,088 KB
testcase_13 AC 65 ms
15,332 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

X, Y, Z = gets.split.map(&:to_i)

ok = 0
ng = 10 ** 9

def f(x)
  z = Z

  if X < x
    z -= x - X
  end

  if Y < x
    z -= x - Y
  end

  z >= 0
end

while (ok - ng).abs > 1
  x = (ok + ng) / 2

  if f(x)
    ok = x
  else
    ng = x
  end
end

puts ok
0