随笔分类 -  leetcode

摘要:将字符数字转为整形数字。 1 int iCharToInt(const char * str) 2 { 3 int i = 0; 4 long long iNum = 0; 5 bool bIsPositiveNumber = true; 6 int iLen = s... 阅读全文
posted @ 2014-12-02 18:41 MDGSF 阅读(165) 评论(0) 推荐(0)
摘要:就是判断一个数是不是回文数字。 1 #include 2 using namespace std; 3 bool bIsPalindrome(int x) 4 { 5 if(x= 10)15 {16 iBase *= 10;17 }18 19 ... 阅读全文
posted @ 2014-12-02 18:39 MDGSF 阅读(122) 评论(0) 推荐(0)
摘要:将罗马数字转化为阿拉伯数字。 1 int romanToInt(string s) 2 { 3 int iResult = 0; 4 map mRoman; 5 mRoman['I'] = 1; 6 mRoman['V'] = 5; 7 mRoman['X'... 阅读全文
posted @ 2014-12-02 18:38 MDGSF 阅读(128) 评论(0) 推荐(0)