
エントリーの編集

エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています

- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
Rubyでローマ数字を求める - Qiita
def getNums() lines = readlines len = lines.length (0..len-1).each do |i| lines[i] = lines[i].cho... def getNums() lines = readlines len = lines.length (0..len-1).each do |i| lines[i] = lines[i].chomp.to_i end return lines end class Integer def to_roman sym = ['I', 'V', 'X', 'L', 'C', 'D', 'M'] roman = '' to_arr(4).each_with_index do |num, i| case i when 0 then roman += sym[6] * num when 1 then case num when 0..3 then roman += sym[4] * num when 4 then roman += sym[4] + sym[5] when 5..8 then roman