1斐波那契数列1.1题目:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少? //斐波那契数列 static void Main(string[] args) { fo...
分类:
其他好文 时间:
2014-11-26 13:52:27
阅读次数:
136
ORDER BY Clauses
In general, the optimizer will skip the sort procedure for the ORDER BY clause if it sees that the rows
will be in order anyway. But let's examine some exceptional situations.
Fo...
分类:
数据库 时间:
2014-11-26 11:19:42
阅读次数:
229
Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.Fo...
分类:
移动开发 时间:
2014-11-25 18:27:58
阅读次数:
156
Lua学习笔记之迭代器与范型for
1、 迭代器与闭包
迭代器是一种支持指针类型的结构,它可以遍历集合的每一个元素。迭代器需要保留上一次成功调用的状态和下一次成功调用的状态,也就是它知道来自于哪里和将要前往哪里。闭包提供的机制可以很容易实现这个任务。记住:闭包是以恶搞内部函数,它可以访问一个或者多个外部函数的外部局部变量。每一次闭包的成功调用后这些局部变量都保存他们的值。
2、 范性fo...
分类:
其他好文 时间:
2014-11-24 19:13:36
阅读次数:
176
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2014-11-23 14:21:58
阅读次数:
205
自定义jquery-validate的验证行为1: 自定义表单提交设置submitHandler来自定义表单提交动作$(".selector").validate({ submitHandler: function(form) { alert("验证通过"); }});如果需要提交表单,可以调用fo...
分类:
Web程序 时间:
2014-11-22 16:02:12
阅读次数:
220
自定义错误消息的显示方式默认情况下,验证提示信息用label元素来显示, 并且会添加css class, 通过css可以很方便设置出错控件以及错误信息的显示方式。/* 输入控件验证出错*/form input.error { border:solid 1px red;}/* 验证错误提示信息*/fo...
分类:
Web程序 时间:
2014-11-22 15:47:59
阅读次数:
165
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo...
分类:
其他好文 时间:
2014-11-22 00:43:18
阅读次数:
130
1 class Solution { 2 public: 3 int removeDuplicates(int A[], int n) { 4 int *s=&A[0],*e=&A[0]; //s指向开头第一个,e往后遍历相同的 5 int t,i,j=n; 6 fo...
分类:
编程语言 时间:
2014-11-22 00:40:25
阅读次数:
215
题意 把1到n这n个数以1为首位围成一圈 输出所有满足任意相邻两数之和均为素数的所有排列
直接枚举排列看是否符合肯定会超时的 n最大为16 利用回溯法 边生成边判断 就要快很多了
#include
using namespace std;
const int N = 50;
int p[N], vis[N], a[N], n;
int isPrime(int k)
{
fo...
分类:
其他好文 时间:
2014-11-20 17:03:58
阅读次数:
190