0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

roman numerals

Last updated at Posted at 2020-11-10

お題

アラビア数字(arabic numerals)を受け取って,ローマ数字(roman numerals)を返すmethodを書きなさい1

ローマ数字で使われる文字

arabic numerals roman numerals
1 I
5 V
10 X
50 L
100 C
500 D
1000 M

arabic numerals roman numerals
1 I
2 II
4 IV
5 V
6 VI
9 IX
10 X
11 XI
14 XIV
15 XV
16 XVI = X + V + I
19 XIX
38 XXXVIII
42 XLII
49 XLIX
51 LI
97 XCVII
99 XCIX
439 CDXXXIX
483 CDLXXXIII
499 CDXCIX
732 DCCXXXII
961 CMLXI
999 CMXCIX
1999

発展

整数はInteger classです.hello classを参照して,Integer classを拡張して,

999.to_roman #=> CMXCIX

と返すようにしなさい.

参照文献


  • source ~/git_hub/ruby_docs/chart_style_ruby/ex_roman_numerals.org
  1. "初めてのプログラミング", Chris Pine (著), 西山 伸 (翻訳),オライリー・ジャパン (2006/7/24).

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?