sadfghjk

来源:互联网 发布:苹果社交软件色情 编辑:程序博客网 时间:2024/06/06 00:53
public class Solution {    public string IntToRoman(int num) {        string[][] roman = new string[][]{              new string[]{"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"},              new string[]{"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"},              new string[]{"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"},              new string[]{"", "M", "MM", "MMM"}          };          string result = "";          int digit = 0;          while (num != 0) {              int remain = num % 10;              result = roman[digit][remain] + result;              digit++;              num /= 10;          }                    return result;      }}

原创粉丝点击