码迷,mamicode.com
首页 >  
搜索关键字:integer    ( 14932个结果)
leetcode(7)Reverse Integer
题目我就不赘述了,可以上官网看得到。算了还是贴一下把。 Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 就是把输入的数值反向输出即可。这里有一个陷阱就是数值溢出的问题。我的代码跟网上别人的不太一样,看到这个题目的我首先想到的就是,把这个int型...
分类:其他好文   时间:2015-05-11 22:10:09    阅读次数:122
POJ1019:Number Sequence
Description A single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2...Sk. Each group Sk consists of a sequence of pos...
分类:其他好文   时间:2015-05-11 21:55:59    阅读次数:104
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 Solution { public: int romanToInt(string s) { unordered_map mp = {{"M",...
分类:其他好文   时间:2015-05-11 21:55:41    阅读次数:133
Integer to Roman
Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. class Solution { public: string intToRoman(int num) { map mp = {{1000,"M"},{9...
分类:其他好文   时间:2015-05-11 21:55:30    阅读次数:130
LeetCode:Happy Number
题目描述: Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of ...
分类:移动开发   时间:2015-05-11 18:03:15    阅读次数:136
【Roman To Integer】cpp
题目:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.代码:class Solution {public: int romanTo...
分类:其他好文   时间:2015-05-11 17:35:39    阅读次数:150
URAL1303——贪心——Minimal Coverage
DescriptionGiven set of line segments [Li, Ri] with integer coordinates of their end points. Your task is to find the minimal subset of the given set ...
分类:其他好文   时间:2015-05-11 17:28:27    阅读次数:113
解题报告 之 POJ2769 Reduced ID Numbers
POJ2769 ,Reduced ID Numbers,数论,同余,ACM T. Chur teaches various groups of students at university U. Every U-student has a unique Student Identification Number (SIN). A SIN s is an integer in the range 0 ≤ s ≤ MaxSIN with MaxSIN = 10 6-1. T. Chur finds this ...
分类:其他好文   时间:2015-05-11 13:01:31    阅读次数:129
【leetcode】7 integer to roman
整数转换为罗马字符注意事项:1 将常用罗马字符保存咋二维数组中,供后期映射查询。存放规则:各位、十位等各一行2 每次从数字的个位映射,循环直至为03 字符串result链接时注意顺序,与普通整数连接顺序不同class Solution {public: char* roman[4][10] = {....
分类:其他好文   时间:2015-05-11 12:49:57    阅读次数:125
【LeetCode】Number of 1 Bits
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 32-bit integer ’11' has binary representation 00000000000000000000000000001011, so the function should return 3....
分类:其他好文   时间:2015-05-11 10:53:29    阅读次数:135
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!