题目:力扣(LeetCode)官网 - 全球极客挚爱的技术成长平台
直接按照题目模拟过程即可
public String intToRoman(int num) {
int []a={1000,900,500,400,100,90,50,40,10,9,5,4,1};
String []b={"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};
String sum = "";
for(int i=0;i<a.length;i++)
{
while(num>=a[i])
{
sum=sum+b[i];
num=num-a[i];
}
}
return sum;
}