結果
問題 | No.26 シャッフルゲーム |
ユーザー |
|
提出日時 | 2017-11-06 15:17:24 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 91 ms / 5,000 ms |
コード長 | 528 bytes |
コンパイル時間 | 63 ms |
コンパイル使用メモリ | 7,296 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-11-24 03:07:31 |
合計ジャッジ時間 | 1,591 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
コンパイルメッセージ
Main.rb:16: warning: assigned but unused variable - i Syntax OK
ソースコード
class No26 attr_accessor :currect, :test_case, :cups def initialize @currect, @test_case = gets.chomp.to_i, gets.chomp.to_i @cups = [0, 0, 0] @cups[@currect - 1] = 1 end def swap!(ary, idx1, idx2) ary[idx1], ary[idx2] = ary[idx2], ary[idx1] ary end def run for i in 0...@test_case do location1, location2 = gets.chomp.split.map(&:to_i) self.swap!(@cups, location1 - 1, location2 - 1) end end end no26 = No26.new no26.run no26.cups.each.with_index{|value, element| puts element + 1 if value == 1}