码迷,mamicode.com
首页 >  
搜索关键字:罗马数字    ( 376个结果
Integer to Roman
/* 题意:把阿拉伯数字转换成罗马数字 解法:直接暴力枚举了。*/class Solution {public: int power(int k){ int res = 1; for(int i = 0 ; i < k ; i++) res*=10; ...
分类:其他好文   时间:2015-04-18 21:50:49    阅读次数:134
Roman to Integer
/* 题意:罗马数字转换成阿拉伯数字 解法:用map映射一下,判断当前字母是否比下一个小,是的话ans加上下一字母的值-当前字母的值, 否则的话直接加上当前字母的值。*/class Solution {public: int romanToInt(string s) { ...
分类:其他好文   时间:2015-04-18 21:50:36    阅读次数:156
[LeetCode] 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. 解题思路: 罗马数字转化成数字。一种方法是映射法,每一位(阿拉伯数字)的字符到阿拉伯数字的映射。如下所示: class Solu...
分类:其他好文   时间:2015-04-18 20:40:01    阅读次数:167
【leetcode】Roman to Integer & Integer to Roman
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.首先,学习一下罗马数字,参考罗马数字罗马数字是最古老的数字表示方式,比阿拉伯数组早200...
分类:其他好文   时间:2015-04-18 20:21:32    阅读次数:116
论文格式解决
在word文档里如何让文章自动生成摘要和目录?将“摘要”在“格式”——“段落”——“大纲级别”——1级,然后硬回车。想在WORD 中设置页码 封皮不要页码 摘要 目录页码用罗马数字编排,绪论以后用阿拉伯数字 具体怎么弄 详细点!!!!!!1、首先将封皮、摘要、目录、绪论进行分节操作,“分隔符”——“...
分类:其他好文   时间:2015-04-03 01:24:11    阅读次数:120
leetcode第12题-Integer to Roman
这是数字转换的第一道题,要求是把阿拉伯数字转换为罗马数字,基本的思想与罗马数字转换为阿拉伯数字差不多,就是提取几个关键的数字作为比较即可。#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
leetcode第13题-Roman to Integer
这道题是把罗马数字转换为阿拉伯数字,转换的方法是:首先把每一个关键字母映射为阿拉伯数字,即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
leetcode题解||Integer to Roman问题
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
leetcode题解 || Roman to Integer问题
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
LeetCode[Math]: Roman to Integer
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(1000)。按照下述的规则...
分类:其他好文   时间:2015-03-03 15:19:41    阅读次数:206
376条   上一页 1 ... 28 29 30 31 32 ... 38 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!