- 36 名前:デフォルトの名無しさん mailto:sage [2017/08/31(木) 00:36:20.74 ID:pRAsTa7t.net]
- Ruby で書いた
https://paiza.io/projects/nBWJ_XFbiayvZ22EvsF0oQ to = 100 ary = [] for i in 1..to flag = false flag = true if 0 == i % 3 i.to_s.each_char do |c| # 各文字 flag = true if "3" == c end ary << i if flag end s_out = "" pre_quo = 0 ary.each do |num| ans = num.divmod(10) # 商と余り if pre_quo < ans[0] && 0 != ans[1] s_out << "\n" # 改行 pre_quo = ans[0] end s_out << sprintf("%2d ", num) end puts s_out
|

|