翻译
给定一个整型数值,将其转换到罗马数字。
输入被保证在1到3999之间。
原文
Given an integer, convert it to a roman numeral.
Input is guaranteed to be within the range from 1 to 3999.
我不会告诉你一开始我是用的无数个变量和 if ……
后来实在受不了这么多变量就将其写成了枚举,那么接下来就迎刃而解了。
为了让大家理解罗马数是怎么计数的,这里我截了一张图,具体的大家可以自行用微软 Bing 搜索。
那么代码我就先贴出来了:
public class Solution
{
public string IntToRoman(int num)
{
string result = "";
Type R = typeof(Roman);
foreach (var r