码迷,mamicode.com
首页 >  
搜索关键字:roman    ( 1299个结果
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
Integer to Roman
Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. string intToRoman(int num) { int numarr[] = {1, 4, 5, 9, 10, 40, 50, 90, 100, 400,...
分类:其他好文   时间:2015-01-29 15:55:56    阅读次数:124
英文版firefox显示中文字体丑的问题
在Options里面选择Content,在Fonts&Colors区域的Default font中,选择Times New Roman在旁边的Advanced中选择,Fonts for:Simplified ChineseProportional:Sans SerifSerif: Microsoft...
分类:其他好文   时间:2015-01-29 14:26:45    阅读次数:258
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
Leetcode#12 Integer to Roman
原题地址找规律+模拟,真没啥可说的。代码: 1 string intToRoman(int num) { 2 string res; 3 4 while (num >= 1000) { 5 res += "M"; 6 ...
分类:其他好文   时间:2015-01-27 20:16:36    阅读次数:170
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
POJ2159Ancient Cipher
DescriptionAncient Roman empire had a strong government system with various departments, including a secret service department. Important documents we...
分类:其他好文   时间:2015-01-26 19:13:07    阅读次数:165
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!