【题目】
Given an integer, convert it to a roman numeral.
Input is guaranteed to be within the range from 1 to 3999.
【题意】
给定一个整数,将其表示成罗马数字
【思路】
罗马数字中只使用如下七个基值字母:M,D,C,L,X,V,I,分别用来表示1000、500、100、50、10、5、1。
罗马数组数规则:
基本数字Ⅰ、X 、C 中的任何一个,自身连用构成数目,或者放在大数的右边连用...
分类:
其他好文 时间:
2014-05-16 01:46:55
阅读次数:
312
这道题当时不会写,是参照discuss写的。
首先要弄明白罗马数字的规则,这个在国外难道是常识吗,为什么题干一点都没讲。。
4000以下一共有下面几种符号:"M", "D", "C", "L", "X", "V", "I",对应到我们十进制为:1000, 500, 100, 50, 10, 5, 1。还有一条非常重要的规则,就是同样的字符最多重复出现三次。这就决定了数位上带4和9的跟普通的数值...
分类:
其他好文 时间:
2014-05-15 00:02:06
阅读次数:
391
Roman to Integer 罗马数字转化为整数...
分类:
其他好文 时间:
2014-05-14 23:49:52
阅读次数:
515
Integer to Roman 罗马数字的转换...
分类:
其他好文 时间:
2014-05-14 21:40:53
阅读次数:
268
Given an integer, convert it to a roman
numeral.Input is guaranteed to be within the range from 1 to 3999.public class
Solution { public String int...
分类:
其他好文 时间:
2014-05-10 20:31:10
阅读次数:
335
Roman to IntegerInteger to
Roman这两题纯粹是模拟题,关键就是理解罗马计数,直接上代码吧class Solution {public: int romanToInt(string s)
{ int result = 0; for (...
分类:
其他好文 时间:
2014-05-09 09:46:36
阅读次数:
298
题目:uva :185 - Roman Numerals
题目大意:给出一个字符串的等式,问这个字符串是否是罗马等式吗?有符合的阿拉伯等式吗?前者是就输出correct or incorrect ,后者就得分情况:
ambiguous 能组成阿拉伯等式的字母组合大于等于2, valid 能组成阿拉伯等式的字母组合只有1种impossible 没有符合阿拉伯等式的字母组合。解...
分类:
其他好文 时间:
2014-05-09 06:06:02
阅读次数:
329
Time New Roman 18
Bold1:资源里定义了三个资源,分别设置对象属性接下来应用资源:2:另一种方式:(WPF中的一个元素都可以使用一个样式,只能使用一个样式)创建一个独立的资源:
应用这个独立的样式资源a CustomizedStyle类的属性:Setters:设置属性值...
分类:
其他好文 时间:
2014-05-09 03:56:46
阅读次数:
266
一次通过: 1 public class Solution { 2 public int
romanToInt(String s) { 3 int sum = 0; 4 int[] num = new int[s.length()]; 5 if...
分类:
其他好文 时间:
2014-05-08 08:24:26
阅读次数:
233