xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

Roman Numerals All In One

Roman Numerals All In One

罗马数字


"use strict";

/**
 *
 * @author xgqfrms
 * @license MIT
 * @copyright xgqfrms
 * @created 2022-03-09
 * @modified
 *
 * @description
 * @description
 * @difficulty Easy Medium Hard
 * @complexity O(n)
 * @time O(n)
 * @augments
 * @example
 * @link https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/roman-numeral-converter
 * @solutions
 *
 * @best_solutions
 *
 */

const log = console.log;

function convertToRoman(num) {
  return num;
}

convertToRoman(36);


 /*

(1) should return "I"
(2) should return "II"
(3) should return "III"
(4) should return "IV"
(5) should return "V"
(9) should return "IX"
10 X
(12) should return "XII"
(16) should return "XVI"

(500) should return "D"
(1000) should return "M"

罗马数字

https://www.mathsisfun.com/roman-numerals.html

数学乐趣

https://www.shuxuele.com/roman-numerals.html

数学乐


https://www.mathopolis.com/questions/

例子:把 1984 转换为 罗马数字。
罗马 1984
把 1984 分成 1000、900、80 和 4,然后逐个转换

1000 = M
900 = CM
80 = LXXX
4 = IV
1000 + 900 + 80 + 4 = 1984,所以 1984 = MCMLXXXIV
 */

refs

https://www.mathsisfun.com/roman-numerals.html

https://www.mathsisfun.com/roman-numerals.html#convert



©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


posted @ 2020-11-09 12:56  xgqfrms  阅读(170)  评论(2编辑  收藏  举报