1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-24 22:38:57 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>罗马数字包含以下七种字符: <code>I</code> <code>V</code> <code>X</code> <code>L</code><code>C</code><code>D</code> 和 <code>M</code>。</p>\n\n<pre>\n<strong>字符</strong> <strong>数值</strong>\nI 1\nV 5\nX 10\nL 50\nC 100\nD 500\nM 1000</pre>\n\n<p>例如, 罗马数字 2 写做 <code>II</code> ,即为两个并列的 1。12 写做 <code>XII</code> ,即为 <code>X</code> + <code>II</code> 。 27 写做  <code>XXVII</code>, 即为 <code>XX</code> + <code>V</code> + <code>II</code> 。</p>\n\n<p>通常情况下,罗马数字中小的数字在大的数字的右边。但也存在特例,例如 4 不写做 <code>IIII</code>,而是 <code>IV</code>。数字 1 在数字 5 的左边,所表示的数等于大数 5 减小数 1 得到的数值 4 。同样地,数字 9 表示为 <code>IX</code>。这个特殊的规则只适用于以下六种情况:</p>\n\n<ul>\n\t<li><code>I</code> 可以放在 <code>V</code> (5) 和 <code>X</code> (10) 的左边,来表示 4 和 9。</li>\n\t<li><code>X</code> 可以放在 <code>L</code> (50) 和 <code>C</code> (100) 的左边,来表示 40 和 90。 </li>\n\t<li><code>C</code> 可以放在 <code>D</code> (500) 和 <code>M</code> (1000) 的左边来表示 400 和 900。</li>\n</ul>\n\n<p>给你一个整数,将其转为罗马数字。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong> num = 3\n<strong>输出:</strong> \"III\"</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong> num = 4\n<strong>输出:</strong> \"IV\"</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong> num = 9\n<strong>输出:</strong> \"IX\"</pre>\n\n<p><strong>示例 4:</strong></p>\n\n<pre>\n<strong>输入:</strong> num = 58\n<strong>输出:</strong> \"LVIII\"\n<strong>解释:</strong> L = 50, V = 5, III = 3.\n</pre>\n\n<p><strong>示例 5:</strong></p>\n\n<pre>\n<strong>输入:</strong> num = 1994\n<strong>输出:</strong> \"MCMXCIV\"\n<strong>解释:</strong> M = 1000, CM = 900, XC = 90, IV = 4.</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= num <= 3999</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 840,
"likes": 857,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Roman to Integer\", \"titleSlug\": \"roman-to-integer\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u7f57\\u9a6c\\u6570\\u5b57\\u8f6c\\u6574\\u6570\"}, {\"title\": \"Integer to English Words\", \"titleSlug\": \"integer-to-english-words\", \"difficulty\": \"Hard\", \"translatedTitle\": \"\\u6574\\u6570\\u8f6c\\u6362\\u82f1\\u6587\\u8868\\u793a\"}]",
@@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"277.9K\", \"totalSubmission\": \"419.2K\", \"totalAcceptedRaw\": 277888, \"totalSubmissionRaw\": 419216, \"acRate\": \"66.3%\"}",
"stats": "{\"totalAccepted\": \"287.8K\", \"totalSubmission\": \"434.3K\", \"totalAcceptedRaw\": 287837, \"totalSubmissionRaw\": 434338, \"acRate\": \"66.3%\"}",
"hints": [],
"solution": null,
"status": null,