由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - int to roman 这么做能过关么?
相关主题
好不容易写了个bug free, 可是被说会秒据, 帮看看美国国会参议院与众医院个人信息
是我自做多情吗奥巴马参加的筹款活动明显超过之前的5任总统
跪求roman number to integer 和 integer to roman number的程序GOP wins in NY House race, seen as Obama rebuke
BBC 编程风格面试题,求指教Dems outpace GOP in lobbyist cash race
Opportunity/Referral - Heat Transfer EngineerEmail Panic From Democrats: ‘Disturbing Report’ of Overflow Crowds at Romney/Ryan Events
心结Obama: “We Can’t Have Perpetual Campaigns”
Re: 从哥林多前书12章,和以弗所书4章,看"合一" (转载)民猪党慌神了
中国人还是要向犹太人学习密西根民主党人说疤蟆care对他来说就是个灾难
相关话题的讨论汇总
话题: string话题: num%话题: num话题: int话题: public
进入JobHunting版参与讨论
1 (共1页)
t**r
发帖数: 3428
1
public class Solution {
public static String intToRoman(int num) {
String M[] = {"", "M", "MM", "MMM"};
String C[] = {"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC",
"CM"};
String X[] = {"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX",
"XC"};
String I[] = {"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII",
"IX"};
return M[num/1000] + C[(num%1000)/100] + X[(num%100)/10] + I[num%10];
}
}
c**********8
发帖数: 1052
2

,
,
,
10];
看面试官心情

【在 t**r 的大作中提到】
: public class Solution {
: public static String intToRoman(int num) {
: String M[] = {"", "M", "MM", "MMM"};
: String C[] = {"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC",
: "CM"};
: String X[] = {"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX",
: "XC"};
: String I[] = {"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII",
: "IX"};
: return M[num/1000] + C[(num%1000)/100] + X[(num%100)/10] + I[num%10];

l******s
发帖数: 3045
3
要把阿三面试官鼻子气歪了。不过一般这种情况喜欢用const string。
t**r
发帖数: 3428
4
haha

【在 l******s 的大作中提到】
: 要把阿三面试官鼻子气歪了。不过一般这种情况喜欢用const string。
1 (共1页)
进入JobHunting版参与讨论
相关主题
密西根民主党人说疤蟆care对他来说就是个灾难Opportunity/Referral - Heat Transfer Engineer
Israel says 2014 is Dems' year心结
黑人对三德子:go f*ck you selfRe: 从哥林多前书12章,和以弗所书4章,看"合一" (转载)
Guccifer 2.0 最新爆料!中国人还是要向犹太人学习
好不容易写了个bug free, 可是被说会秒据, 帮看看美国国会参议院与众医院个人信息
是我自做多情吗奥巴马参加的筹款活动明显超过之前的5任总统
跪求roman number to integer 和 integer to roman number的程序GOP wins in NY House race, seen as Obama rebuke
BBC 编程风格面试题,求指教Dems outpace GOP in lobbyist cash race
相关话题的讨论汇总
话题: string话题: num%话题: num话题: int话题: public