結果
問題 | No.546 オンリー・ワン |
ユーザー | siman |
提出日時 | 2021-12-28 01:39:05 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 91 ms / 2,000 ms |
コード長 | 266 bytes |
コンパイル時間 | 227 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-10-01 13:06:34 |
合計ジャッジ時間 | 1,867 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 7 |
コンパイルメッセージ
Syntax OK
ソースコード
N, L, H = gets.split.map(&:to_i)C = gets.split.map(&:to_i)ans = 01.upto(N) do |n|C.combination(n) do |nums|l = nums.inject(:lcm)cnt = H / l - (L - 1) / lif n.even?ans -= n * cntelseans += n * cntendendendputs ans