結果

問題 No.546 オンリー・ワン
ユーザー ueyukiueyuki
提出日時 2017-07-19 23:59:12
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 376 bytes
コンパイル時間 53 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 17,792 KB
最終ジャッジ日時 2024-04-17 04:13:22
合計ジャッジ時間 4,189 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
17,792 KB
testcase_01 AC 87 ms
12,160 KB
testcase_02 AC 90 ms
12,160 KB
testcase_03 AC 87 ms
12,416 KB
testcase_04 AC 86 ms
12,416 KB
testcase_05 AC 87 ms
12,288 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n, l, h = gets.chomp.split.map(&:to_i)
c = gets.chomp.split.map(&:to_i)

if c.count(1) == 1
  if c.size == 1
    puts(h-l+1) 
    exit
  end
elsif c.count(1) > 1
  puts 0
  exit
end

answerCount = 0

l.upto(h) do |i|
  disCount = 0
  0.upto(n-1) do |j|
    if i % c[j] == 0
      disCount += 1
    end
  end
  if disCount == 1
    answerCount += 1
  end
end

puts answerCount
0