先看效果图: 游戏结束图: javascript实现源码:
俄罗斯方块
© 2009 - 2014 All Rights by ithomer.net
var domain="www.zuidaima.com";
var author="zuidaima";
var map=eval("["+Array(23).join("0x801,")+"0xfff]");
var tatris=[...
分类:
编程语言 时间:
2014-05-23 02:19:04
阅读次数:
253
【题目】
Given a collection of numbers, return all possible permutations.
For example,
[1,2,3] have the following permutations:
[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1].
【题意】
给定一个数组,生成所有的全排列
【思路】
递归,类DFS...
分类:
其他好文 时间:
2014-05-23 01:08:26
阅读次数:
194
剑指offer上的全排列相关题目。
输入一个含有8个数字的数组,判断有么有可能把这8个数字分别放到正方体的8个顶点上,使得正方体上三组相对的面上的4个顶点的和相等。
思路:相当于求出8个数字的全排列,判断有没有一个排列符合题目给定的条件,即三组对面上顶点的和相等。
代码:...
分类:
其他好文 时间:
2014-05-23 00:26:58
阅读次数:
418
??
qsort和sort的区别
First qsort
基本快速排序的方法,每次把数组分成两分和中间的一个划分值,而对于有多个重复值的数组来说,基本排序的效率较低。集成在C语言库函数里面的的qsort函数,使用 三 路划分的方法解决这个问题。所谓三路划分,是指把数组划分成小于划分值,等于划分值和大于划分值的三个部分。
函数对buf 指向的数据按升序排序。
使...
分类:
其他好文 时间:
2014-05-22 23:10:46
阅读次数:
389
Remove Duplicates from Sorted Array...
分类:
其他好文 时间:
2014-05-22 23:06:48
阅读次数:
271
题目链接:hdu 4823 Energy Conversion
题目大意:中文题,不解释。
解题思路:首先判断一下m是否已经大于n了,如果大于那么就是0,假设中间变换的各个值为ai,那么bi=ai+c,bi数组为等比数组(可推),所以就有了cnt=log((n+c)a)log(double(k)),结果为浮点数,需要向上取整。
#include
#include
#include...
分类:
其他好文 时间:
2014-05-22 22:34:41
阅读次数:
308
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1228
1、 没读清题就交-----a==0 && b==0 我以为zero zero借书
2、范围估计,100+100。。。。
3、代码设计,,,,
#include
#include
using namespace std;
#define SIZE 111
#define ll long...
分类:
其他好文 时间:
2014-05-22 18:46:45
阅读次数:
513
题目:http://poj.org/problem?id=1226
http://acm.hdu.edu.cn/showproblem.php?pid=1238
其实用hash+lcp可能也可以,甚至可能写起来更快,不过我没试,我最近在练习后缀数组,所以来练手
后缀数组的典型用法之一----------------后缀数组+lcp+二分
思路:1、首先将所有的字符串每读...
分类:
其他好文 时间:
2014-05-22 17:14:08
阅读次数:
289
这是编程之美上的一个题目:
一般的做法:
void main()
{
int a[5]={78,63,78,67,18};
int min=0,max=0;
min=max=a[0];
for(int i=0;ia[i])
min=a[i];
if(max<a[i])
max=a[i];
}...
分类:
其他好文 时间:
2014-05-22 17:04:23
阅读次数:
221
【题目】
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Your goal is to reach the last index in the minimum number of ju...
分类:
其他好文 时间:
2014-05-22 17:02:20
阅读次数:
244