Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Created December 28, 2015 00:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatalnk/8e7eec68024ddd565d27 to your computer and use it in GitHub Desktop.
Save whatalnk/8e7eec68024ddd565d27 to your computer and use it in GitHub Desktop.
yukicoder No.026
# [No.26 シャッフルゲーム - yukicoder](http://yukicoder.me/problems/74)
n = gets.chomp.to_i
m = gets.chomp.to_i
cups = Array.new(4, false)
cups[n] = true
m.times do
p_, q_ = gets.chomp.split(" ").map(&:to_i)
cups[p_], cups[q_] = cups[q_], cups[p_]
end
puts cups.index(true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment