码迷,mamicode.com
首页 >  
搜索关键字:integer    ( 14932个结果)
循环结构
步长型循环(For语句) for 语句用来描述已知重复次数的循环结构。 for 语句有两种形式:   (1) for 循环变量:=初值 to 终值 do 语句;   (2) for 循环变量:=初值 downto 终值 do 语句; 例:计算1+2+3+……+99+100的和 program jia; var    i,n,sum:integer; begin  sum:=...
分类:其他好文   时间:2015-07-20 16:47:52    阅读次数:185
LeetCode Majority Element II
Given an integer array of size n, find all elements that appear more than ? n/3 ? times. The algorithm should run in linear time and in O(1) space.Hint:How many majority elements could it possibly hav...
分类:其他好文   时间:2015-07-20 16:28:47    阅读次数:133
子界类型、集合类型、记录类型、文件类型
子界类型 如果我们定义一个变量i为integer类型,那么i的值在微型机系统的pascal中,使用2字节的定义表示法,取值范围为-32768~32767。而事实上,每个程序中所用的变量的值都有一个确定的范围。 例如,人的年龄一般不超过150,一个班级的学生不超过100人,一年中的月数不超过12,一月中的天数不超过31,等等。 如果我们能在程序中对所用的变量的值域作具体规定的话,就便于检查出那...
分类:其他好文   时间:2015-07-20 13:08:19    阅读次数:179
Leetcode -- Day 12
Question1Power of TwoGiven an integer, write a function to determine if it is a power of two.This question is pretty simple. If a number is a power of...
分类:其他好文   时间:2015-07-20 12:47:54    阅读次数:99
LeeCode-Roman to Integer
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999. 1 class Solution { 2 public: 3 int roma...
分类:其他好文   时间:2015-07-20 10:41:04    阅读次数:98
LeeCode-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...
分类:移动开发   时间:2015-07-20 10:37:56    阅读次数:130
LeeCode-Power of Two
Given an integer, write a function to determine if it is a power of two. 1 bool isPowerOfTwo(int n) 2 { 3 if(n1)10 {11 if(n%2==0)12 ...
分类:其他好文   时间:2015-07-20 10:37:32    阅读次数:124
LeeCode-Merge Sorted Array
Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:You may assume thatnums1has enough space (size that is great...
分类:其他好文   时间:2015-07-20 10:33:13    阅读次数:108
LeeCode-Number of 1 Bits
Write a function that takes an unsigned integer and returns the number of ’1' bits it hasFor example, the 32-bit integer ’11' has binary representatio...
分类:其他好文   时间:2015-07-20 10:29:37    阅读次数:104
【LeetCode-面试算法经典-Java实现】【012-Integer to Roman(数字转罗马字符)】
【012-Integer to Roman(数字转罗马字符)】输入一个数字,将它转成一个罗马数字,输入的数字在[1, 3999]之间。   罗马数字的表示:   个位数举例: (I, 1) (II, 2) (III, 3) (IV, 4) (V, 5) (VI, 6) (VII, 7) (VIII, 8) (IX, 9)   十位数举例:(X, 10) (XI, 11) (XII, 12) (X...
分类:编程语言   时间:2015-07-20 09:21:27    阅读次数:135
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!