結果

問題 No.338 アンケート機能
ユーザー gemmarogemmaro
提出日時 2020-07-27 09:21:39
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 389 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 11,248 KB
実行使用メモリ 15,412 KB
最終ジャッジ日時 2023-09-11 05:43:22
合計ジャッジ時間 4,439 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,088 KB
testcase_01 AC 86 ms
15,280 KB
testcase_02 AC 84 ms
15,248 KB
testcase_03 AC 83 ms
15,252 KB
testcase_04 WA -
testcase_05 AC 93 ms
15,208 KB
testcase_06 AC 83 ms
15,108 KB
testcase_07 AC 92 ms
15,172 KB
testcase_08 AC 84 ms
15,088 KB
testcase_09 AC 93 ms
15,368 KB
testcase_10 AC 83 ms
15,252 KB
testcase_11 AC 83 ms
14,972 KB
testcase_12 AC 84 ms
15,048 KB
testcase_13 AC 84 ms
15,212 KB
testcase_14 AC 84 ms
15,104 KB
testcase_15 AC 84 ms
15,108 KB
testcase_16 AC 83 ms
15,256 KB
testcase_17 AC 83 ms
15,120 KB
testcase_18 AC 84 ms
15,236 KB
testcase_19 AC 84 ms
15,168 KB
testcase_20 AC 94 ms
15,392 KB
testcase_21 AC 93 ms
15,268 KB
testcase_22 AC 92 ms
15,048 KB
testcase_23 AC 84 ms
15,040 KB
testcase_24 AC 85 ms
15,196 KB
testcase_25 AC 93 ms
15,412 KB
testcase_26 AC 93 ms
15,280 KB
testcase_27 AC 93 ms
15,208 KB
testcase_28 AC 84 ms
15,048 KB
testcase_29 AC 85 ms
15,188 KB
testcase_30 AC 84 ms
15,256 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# frozen_string_literal: true

MAX = 1000

# solve
#
# NOTE: `return...` and `(1..max)` is necessary
# in order to avoid zero division.
def solve
  return 0 if A.zero? && B.zero?

  (0..MAX).find do |max|
    (1..max).any? do |a|
      b = max - a
      A == Rational(100 * a, a + b).round && B == Rational(100 * b, a + b).round
    end
  end
end

A, B = gets.split.map(&:to_i)

puts solve
0