??
问题描述:Given a roman numeral, convert it to an integer.
Input is guaranteed to be within the range from 1 to3999.
问题分析:{'M','D','C','L','X','V','I'};分别对应{1000, 500, 100, 50, 10, 5, 1};
当出...
分类:
其他好文 时间:
2015-04-10 22:30:55
阅读次数:
142
有点意思~ 只要相应的处理好对于 4 和 9 这两种特殊情况就好了.其他都是简单的加法
好吧, 老老实实贴出我的解答, 好丑... 不够简洁.. 可以看皓神的解答...
Python:
"""
Programmer : EOF
Date : 2015.04.10
File : itr.py
E-mail : ja...
分类:
其他好文 时间:
2015-04-10 17:51:21
阅读次数:
118
??
问题描述:Given an integer, convert it to a roman numeral.
Input is guaranteed to be within the range from 1 to3999.
问题分析:类似于十进制,从高位进行计算即可
代码:
public class Solution {
public String intTo...
分类:
其他好文 时间:
2015-04-08 16:36:44
阅读次数:
99
一:Integer to Roman
题目:
Given an integer, convert it to a roman numeral.
Input is guaranteed to be within the range from 1 to 3999.
链接:https://leetcode.com/problems/integer-to-roman/
分析:此题...
分类:
其他好文 时间:
2015-04-05 16:02:09
阅读次数:
156
这是数字转换的第一道题,要求是把阿拉伯数字转换为罗马数字,基本的思想与罗马数字转换为阿拉伯数字差不多,就是提取几个关键的数字作为比较即可。#include
#include
#include
char *link(char *s1,char *s2)
{
int len1=strlen(s1);
int len2=strlen(s2);
for(int i=len1;i<len1+len2...
分类:
其他好文 时间:
2015-03-30 14:40:28
阅读次数:
119
这道题是把罗马数字转换为阿拉伯数字,转换的方法是:首先把每一个关键字母映射为阿拉伯数字,即I是1、V是5、X是10、L是50、C是100、D是500、M是1000.然后每一位的阿拉伯数字与其后面的(假如有的话)比较,如果不小于,则加上当前的数字,如果小于后面的数字,则加上两者的差,代码如下:#include
#include
#include
int romanToInt(char *s)
{
...
分类:
其他好文 时间:
2015-03-28 10:10:41
阅读次数:
194
毕业bg
Time Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)
Total Submission(s) : 6 Accepted Submission(s) : 3
Font: Times New Roman | Verdana | Georgia
Font Si...
分类:
其他好文 时间:
2015-03-27 22:26:07
阅读次数:
194
problem:
Given an integer, convert it to a roman numeral.
Input is guaranteed to be within the range from 1 to 3999.
将1-3999的整数转换为罗马数字
thinking:
(1)
对照举例
个位数举例
Ⅰ,1 】Ⅱ,2】 Ⅲ,3】 Ⅳ,4 】Ⅴ,5 】Ⅵ...
分类:
其他好文 时间:
2015-03-18 18:11:35
阅读次数:
92
problem:
Given a roman numeral, convert it to an integer.
Input is guaranteed to be within the range from 1 to 3999.
将罗马数字转为整数
thinking:
(1)罗马数字规则:
罗马数字共有7个,即I(1)、V(5)、X(10)、L(50)、C(100)...
分类:
其他好文 时间:
2015-03-18 18:09:37
阅读次数:
130
Ancient CipherTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 29372 Accepted: 9622DescriptionAncient Roman empire had a strong government .....
分类:
其他好文 时间:
2015-03-13 20:26:22
阅读次数:
142