結果
| 問題 | No.26 シャッフルゲーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-08-02 15:07:39 | 
| 言語 | Ruby (3.4.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 97 ms / 5,000 ms | 
| コード長 | 426 bytes | 
| コンパイル時間 | 58 ms | 
| コンパイル使用メモリ | 7,424 KB | 
| 実行使用メモリ | 12,288 KB | 
| 最終ジャッジ日時 | 2024-11-06 23:36:33 | 
| 合計ジャッジ時間 | 1,820 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
コンパイルメッセージ
Syntax OK
ソースコード
class Calc0026
  def initialize
    args = STDIN.readlines.map { |l| l.chomp.split(/\s+/) }
    @n = args.shift.first.to_i
    @m = args.shift.first.to_i
    @shuffles = args.map { |l| l.map(&:to_i) }
  end
  def calc
    n = @n
    @shuffles.each do |shuffle|
      if shuffle.include?(n)
        n = (shuffle - [n]).first
      end
    end
    n
  end
  def run
    puts calc
  end
end
Calc0026.new.run if __FILE__ == $0
            
            
            
        