2018-04-29から1日間の記事一覧

AOJ(Introduction to Algorithms and Data Structures)その1

AIZU ONLINE JUDGE: Programming Challenge ALDS1_1_A #挿入ソート gets ar = gets.split.map(&:to_i) n = ar.size putout = ->{puts ar.join(" ")} putout.() 1.upto(n - 1) do |i| v = ar[i] j = i - 1 while j >= 0 and ar[j] > v ar[j + 1] = ar[j] j -=…