12
题目链接:https://leetcode-cn.com/problems/integer-to-roman/
题解
```
class Solution {
int[] values = {1000,900,500,400,100,90,50,40,10,9,5,4,1};
String[] Strings = {"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};
public String intToRoman(int num) {
StringBuffer valueBuffer = new StringBuffer();
for(int i = 0;i<values.length;++i){
while(num>=values[i]){
num-=values[i];
valueBuffer.append(Strings[i]);
}
if(num==0) break;
}
return valueBuffer.toString();
}
}
```