http://acm.sdibt.edu.cn/JudgeOnline/problem.php?id=2325
题目大意:(如题)
输入输出:(如题)
解题思路:
1.用打表法将每个数N(1
2.枚举。从千位开始枚举,一直枚举到个位为止,每次判断减掉那个数之后剩下的数是否还不小于0。如果不小于则继续,反之结束。
3.减小代码的方法。
(1) 10进制数到罗马数字的转换表:
stri...
分类:
其他好文 时间:
2014-10-27 12:45:46
阅读次数:
196
Given a roman numeral, convert it to an integer.
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(...
分类:
其他好文 时间:
2014-10-25 14:35:27
阅读次数:
192
首先,学习一下罗马数字,参考罗马数字罗马数字是最古老的数字表示方式,比阿拉伯数组早2000多年,起源于罗马罗马数字有如下符号:基本字符IVXLCDM对应阿拉伯数字1510501005001000计数规则: 相同的数字连写,所表示的数等于这些数字相加得到的数,例如:III = 3小的数字在大的数字右边...
分类:
其他好文 时间:
2014-10-20 16:58:47
阅读次数:
165
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.Solution:此题是要求把罗马数字转换成数字。首先,学习一下罗马数字,参考罗马数字罗...
分类:
其他好文 时间:
2014-10-19 13:01:54
阅读次数:
248
Problem:Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.把阿拉伯数字转换为罗马数字输出。百度一下对应的 I V X L C D ...
分类:
其他好文 时间:
2014-10-15 01:28:39
阅读次数:
267
【题目】
Given a roman numeral, convert it to an integer. Or, Given an integer, convert it to a roman numeral.
Input is guaranteed to be within the range from 1 to 3999.
【罗马数字】
1~9: {"I", "II", "III...
分类:
其他好文 时间:
2014-10-10 22:23:44
阅读次数:
182
题目:
Given a roman numeral, convert it to an integer.
Input is guaranteed to be within the range from 1 to 3999.
题目意思很简单,即将一个罗马数字的字符串,转化为整数。
首先我们需要对罗马数字有一个基本的认识,由于题目已将数字大小限定在1~3999,所以我们只需考虑...
分类:
其他好文 时间:
2014-10-10 13:32:24
阅读次数:
200
将给定的数字(阿拉伯数字)转化成罗马数字。数字不会大于3999...
分类:
其他好文 时间:
2014-10-09 02:18:57
阅读次数:
186
写在前面:
这两道题合起来写吧,其实整数转罗马数字我前天就写完了,当我想写罗马数转整数的时候竟然脑子一片空白,想了几分钟就想起来Map,本着学习的目的最终还是不想用Map,坚持C语言,今天脑子里直接涌出了Switch方式转换,看来“蹲在马桶上编程”的方式还是蛮不错的o(^▽^)o
整数转罗马数字:主要建立对应关系,输出时有点像百钱百鸡
罗马数字转整数:输入罗马数字(其实就是字符数组)后,fo...
分类:
其他好文 时间:
2014-09-29 01:29:37
阅读次数:
403
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999. 罗马数字有如下符号:罗马字符: I V X L C D M对应数字...
分类:
其他好文 时间:
2014-09-11 22:07:42
阅读次数:
271