题目
Implement pow(x, n).
方法
注意Integer.MIN_VALUE值和Integer.MAX_VALUE值。
public double pow(double x, int n) {
if (n == 0) {
return 1;
}
if (n == Integer.MIN_VAL...
分类:
其他好文 时间:
2014-06-19 10:37:27
阅读次数:
210
http://poj.org/problem?id=3233
ps转:
用二分方法求等比数列前n项和:即
原理:
(1)若n==0
(2)若n%2==0
(3)若n%2==1
代码如下:
LL sum(LL p,LL n)
{
if(n==0) return 1;
i...
分类:
其他好文 时间:
2014-06-15 20:01:44
阅读次数:
210
从一道小题下手(该考点曾被腾讯等大公司作为基础笔试题考过),
#include
int size(char a[10])
{
return sizeof(a);
}
int main(void)
{
char a[] = {'C','h','i','n','a','\0'};
char *p = "China";
char *q = a;
prin...
分类:
其他好文 时间:
2014-06-15 19:19:52
阅读次数:
221
Given a binary tree, return the postorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [3,2,1].
Note: Recursive solut...
分类:
其他好文 时间:
2014-06-15 19:06:52
阅读次数:
166
一、第一个窗口程序
1 入口函数 WinMain
2 窗口处理函数
LRESULT CALLBACK WndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
{
return DefWindowProc( hWnd, nMsg, wParam, lParam );
}
当窗口处理消息事件时 调用该函数
...
题目
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
You may assume no duplicates i...
分类:
其他好文 时间:
2014-06-15 17:27:16
阅读次数:
251
1、
??
Unique Binary Search Trees II
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.
For example,
Given n = 3, your program should return all 5 uni...
分类:
其他好文 时间:
2014-06-15 09:09:00
阅读次数:
256
4.1 确认表单必填项目完整性
function check_submit(){
if($("tex_user_name").value=="") {alert("请输入用户名");return (false);}
if($("txt_user_pass").value=="") {alert("请输入密码");return (false);}
if($...
分类:
编程语言 时间:
2014-06-15 08:50:23
阅读次数:
272
题目
Given two numbers represented as strings, return multiplication of the numbers as a string.
Note: The numbers can be arbitrarily large and are non-negative.
方法
将num1与0-9相乘的结果存...
分类:
其他好文 时间:
2014-06-14 06:08:30
阅读次数:
229