1.if...elif...else... 1 number = 23 2 guess = int(raw_input('Enter an integer : ')) 3 4 if guess == number: 5 print( 'Congratulations, you guesse...
分类:
编程语言 时间:
2014-10-28 15:22:41
阅读次数:
188
常见的crud方法签名使用以下几个:
Attach get(Integer attachId);
Attach save(Attach attach)或Integer save(Attach attach);
void delete(Integer attachId);
void update(At...
分类:
其他好文 时间:
2014-10-28 11:55:30
阅读次数:
368
Matrix Power Series
Time Limit: 3000MS
Memory Limit: 131072K
Total Submissions: 15739
Accepted: 6724
Description
Given a n × n matrix A and a positive integer k, fi...
分类:
其他好文 时间:
2014-10-28 10:25:00
阅读次数:
158
这题分两步,第一步由给定的p字符串得到原来的括号表达式,第二步由括号表达式得到W字符串。q By an integer sequence P = p1 p2...pn where pi is the number of left parentheses before the ith right pa...
分类:
其他好文 时间:
2014-10-28 10:16:45
阅读次数:
154
核心思想:原数对10取余数赋值给新数后降一位,再把新数升一位加上下一次原数取余值,直到原数降为0。解法如下: 1 int reverse(int x) { 2 bool minus = false; 3 if(x<0) 4 { 5 ...
分类:
其他好文 时间:
2014-10-28 08:11:27
阅读次数:
213
刚看到题就想用数组做,发现大多数解也是用数组做的,突然看到一个清新脱俗的解法: 1 int atoi(const char *str) { 2 3 4 5 if(*str == '\0') return 0; 6 7 int n; 8 9 ...
分类:
其他好文 时间:
2014-10-28 08:10:59
阅读次数:
175
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
考虑输入是abc,返回结果是cba,那么如果用除法(除以10)取余数操作的话,是先入先出的操作(第一次入abc%10=c),因此选择使用队列。
复习队列的方法有q.size(),q.front()...
分类:
其他好文 时间:
2014-10-27 23:05:42
阅读次数:
200
/**在键盘上随机输入n个数字存入List中输出其从大到小的结果*/publicclassTest01{publicstaticvoidmain(String[]args){ Listlist1=newArrayList(); Integercnt=0; for(inti=0;i<args.length;i++) {list1.add(cnt.parseInt(args[i]));//String转型为Integer后存入list1中 } S..
分类:
编程语言 时间:
2014-10-27 19:46:02
阅读次数:
474
Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (i...
分类:
其他好文 时间:
2014-10-27 19:28:33
阅读次数:
217
转自:http://www.tianzhigang.com/article.asp?id=280PHP的数据类型转换属于强制转换,允许转换的PHP数据类型有:(int)、(integer):转换成整形(float)、(double)、(real):转换成浮点型(string):转换成字符串(bool...
分类:
Web程序 时间:
2014-10-27 19:04:40
阅读次数:
233