思路:
// @Title: 整数转罗马数字 (Integer to Roman)
// @Author: qisiii
// @Date: 2024-04-11 23:31:56
// @Runtime: 3 ms
// @Memory: 43.1 MB
// @comment:
// @flag:
class Solution {
public String intToRoman(int num) {
int[] ala=new int[]{1000,900,500,400,100,90,50,40,10,9,5,4,1};
String[] lm=new String[]{"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};
StringBuilder str=new StringBuilder();
for(int i=0;i<ala.length;i++){
//2999
while(num>=ala[i]){
str.append(lm[i]);
num=num-ala[i];
}
}
return str.toString();
}
}