码迷,mamicode.com
首页 >  
搜索关键字:罗马数字    ( 376个结果
leetcode12----------Integer to Roman
Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 罗马数字规则:参考wiki:http://zh.wikipedia.org/wiki/%E7%BD%97%E9%A9%AC%E6%95%B0%E5%AD%97     1,...
分类:其他好文   时间:2015-01-30 09:19:22    阅读次数:196
LeetCode --- 12. Integer to Roman
题目链接:Integer to Roman Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 这道题的要求是将整数转化成罗马数字,其中输入数据范围是1到3999。 罗马数字是最早的数字表示方式,比阿拉伯数字早2000多年,起源...
分类:其他好文   时间:2015-01-29 12:48:44    阅读次数:181
LeetCode --- 13. Roman to Integer
题目链接:Roman to Integer Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 这道题的要求是将罗马数字转化成整数,其中输入数据范围是1到3999。 罗马数字是最早的数字表示方式,比阿拉伯数字早2000多年,起源...
分类:其他好文   时间:2015-01-29 12:48:40    阅读次数:121
leetcode12 Integer to Roman
这个题目是把1~3999之间的整数转换为罗马数字。首先列举一下几个基本的罗马数字,1---I,5---V,10---X,50---L,100---C,500---D,1000---M。其他的罗马数字都是由这几个组成的。一个较小的单位连在较大单位前面,表示后面的减去前面的,比如CM即为900,XL即为40。我自己写了一个方法,但是比较笨拙,如下所示: 在网上看了看别人的代码,写的都很好,而...
分类:其他好文   时间:2015-01-28 09:58:19    阅读次数:135
leetcode13 Roman to Integer
这个题目是把罗马数字转换为整数,比如输入字符串 MCMLXXXIV,输出为整数1984。观测罗马数字的规律,我们得到,其实可以直接相加每个字符代表的整数即可,比如CLIII这个罗马数字对应的整数即为100+50+1+1+1=153。但是,若是两个字符代表一个数字时,我们就需要注意了,比如IV即为5-1=4。因此,我们得到规律,没读入字符串的一个字符,都将它与之后一个字符代表的数字比较,如果前者较小...
分类:其他好文   时间:2015-01-28 09:57:36    阅读次数:194
LeetCode13——Roman to Integer
Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 题目大意 给你个罗马数字,把它转换成一个int数。输入限定在[1, 3999]。 难度系数:容易 实现 一次性通过,:) int getVal(c...
分类:其他好文   时间:2015-01-27 18:22:38    阅读次数:160
$\LaTeX$笔记:Section 编号方式(数字、字母、罗马)
$\LaTeX$系列根目录: Latex学习笔记-序IEEE模板中Section的编号是罗马数字,要是改投其他刊物的话可能得用阿拉伯数字,所以可以在导言部分做如下修改(放在导言区宏包调用之后):\renewcommand\thesection{\arabic{section}} %arabic 阿拉...
分类:其他好文   时间:2015-01-26 22:19:34    阅读次数:16804
LeetCode Roman to Integer
Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 题意:讲罗马数字转换成阿拉伯数字 思路:了解罗马数字的构造后,从后往前处理就行了 class Solution { public: int romanToInt(s...
分类:其他好文   时间:2015-01-23 00:54:13    阅读次数:207
[LeetCode]13.Roman to Integer
【题目】 Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 【分析】 这是一种首先会想到的思路:一个一个字母解析,先解析是不是双字母罗马数字,如果不是就按单字母罗马数字解析。 【代码】 /***********...
分类:其他好文   时间:2015-01-22 15:26:52    阅读次数:134
正则表达式 匹配罗马数字 并且返回匹配到的值
正则 罗马数字...
分类:其他好文   时间:2015-01-22 11:13:10    阅读次数:868
376条   上一页 1 ... 30 31 32 33 34 ... 38 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!