今天第一次主要到Delphi也有goto语法,特别是其奇怪的label声明。估计主要是用来跳出多重循环,而且还真有人使用这种方式。记个笔记:procedure TForm1.btn3Click(Sender: TObject);var I, J: Integer;label label1...
分类:
其他好文 时间:
2014-06-28 14:29:04
阅读次数:
225
1.if语句(python中没有switch语句,可用if……elif……else代替)格式: if 表达式: #语句 else: #语句eg:number = 23guess = int(raw_input('Enter an integer:'))if guess == numb...
分类:
编程语言 时间:
2014-06-28 11:35:24
阅读次数:
253
题目描述Given a non-negative integer sequence A with length N, you can exchange two adjacent numbers each time. After K exchanging operations, what’s the ...
分类:
其他好文 时间:
2014-06-22 23:36:42
阅读次数:
232
Determine whether an integer is a palindrome. Do this without extra space.
思路:若使用【Leetcode】Reverse
Integer 的方法,判断反转后的整数是否与原整数相同,则可能出现溢出情况;又因为题目要求不适用额外空间,可以之间对比整数第一个与最后一个数的值,再依次类推。
class Solution {...
分类:
其他好文 时间:
2014-06-22 20:43:56
阅读次数:
187
谜题24
byte是有符号的,范围是-128 - 127。而0x90是int类型。比较的时候,不相等。
如果想让其相等,需要进行类型转换:(byte & 0xff) 或者 (byte)0x99。
谜题25
自增运算符对循环的影响。j = j++,先赋值。
谜题26
Integer.MAX_VALUE加一之后会变成Integer.MIN_VALU...
分类:
编程语言 时间:
2014-06-22 18:32:20
阅读次数:
254
Intervals
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 20786
Accepted: 7866
Description
You are given n closed, integer intervals [ai, bi] and n integer...
分类:
其他好文 时间:
2014-06-22 16:36:24
阅读次数:
152
Description
Let S = s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two different ways:
q By an integer sequence P = p1 p2...pn where pi is the number of left parentheses...
分类:
其他好文 时间:
2014-06-22 14:06:49
阅读次数:
249
N-QueensThe n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, retu...
分类:
其他好文 时间:
2014-06-22 13:10:11
阅读次数:
188
Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321click to show spoilers.Have you thought about this?Here are som...
分类:
其他好文 时间:
2014-06-21 15:20:39
阅读次数:
191