摘要: Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.分析从前往后扫描,因为左减数字只能最多一位,并且比当前数字小,所以扫描的时候不断判断当前罗马字符和上一个的大小,如果s[i-1] 0 && map(s[i]) > map(s[i - 1... 阅读全文
posted @ 2016-12-04 15:30 copperface 阅读(199) 评论(0) 推荐(0) 编辑
摘要: Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.分析罗马数字共有7个,即I(1)、V(5)、X(10)、L(50)、C(100)、D(500)和M(1000)。按照下述的规则可以表示任意正整数。需要注意的是罗马数字中没有“0”,与进位制... 阅读全文
posted @ 2016-12-04 14:45 copperface 阅读(206) 评论(0) 推荐(0) 编辑