結果
問題 | No.78 クジ付きアイスバー |
ユーザー |
![]() |
提出日時 | 2016-03-23 23:19:06 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 699 bytes |
コンパイル時間 | 103 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-10-06 19:03:33 |
合計ジャッジ時間 | 4,876 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 18 WA * 17 |
コンパイルメッセージ
Syntax OK
ソースコード
class Yukicoderdef initializen, k = gets.chomp.split.map(&:to_i)s = gets.chomplist = Array.new(n, 0)buy_count = 0atari_cost = 0s.chars.each_with_index do |ch, index|if atari_cost > 0atari_cost -= 1elsebuy_count += 1endlist[index] = buy_countif ch == '1'atari_cost += 1elsif ch == '2'atari_cost += 2endendif n >= kputs list[k-1]elsex = k / ny = [buy_count, atari_cost].map{|i| i * x}if k % n == 0puts [y[0] - y[1], 1].maxelseputs [list[k%n-1] + y[0] - y[1], 1].maxendendendendYukicoder.new