Follow up for N-Queens problem.
Now, instead outputting board configurations, return the total number of distinct solutions.
算法一
利用permutation中使用swap的思路,可以快速满足列条件的限制。
这样,在检查合法性时,只需要检查是...
分类:
其他好文 时间:
2015-02-04 16:39:21
阅读次数:
169
B - B
Description
The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in...
分类:
其他好文 时间:
2015-02-04 14:48:16
阅读次数:
141
参考 :http://blog.csdn.net/zhangxin09/article/details/6914882An Ext JS application's UI is made up of one or many widgets calledComponents. All Componen...
分类:
Web程序 时间:
2015-02-04 14:22:29
阅读次数:
149
#!/usr/bin/perl
use strict;
use warnings;
use threads;
use Thread::Semaphore;
my $max_thread = 5;
my $semaphore = Thread::Semaphore->new($max_thread);
sub TestFun
{
$semaphore->up();
}
for(my $ind...
分类:
编程语言 时间:
2015-02-04 13:03:43
阅读次数:
344
w 命令:--w 查看的是系统整体上的负载# w 15:23:46 up 3:34, 2 users, load average: 0.03, 0.05, 0.00USER TTY FROM LOGIN@ IDLE JCPU PCPU W...
分类:
其他好文 时间:
2015-02-04 10:59:11
阅读次数:
181
Coin sums
Problem 31
In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:
1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
It ...
分类:
编程语言 时间:
2015-02-04 09:34:29
阅读次数:
194
Follow up for "Unique Paths":
Now consider if some obstacles are added to the grids. How many unique paths would there be?
An obstacle and empty space is marked as 1 and 0 respectively in th...
分类:
编程语言 时间:
2015-02-04 09:28:40
阅读次数:
172
http://poj.org/problem?id=3468题意 :对于一个序列有两种操作 1 查询 l到r 的和 2 对于l 到r上的每个数 加上 up思路: 用单点更新必然超时 所以需要区间更新(位运算时 注意 m-m>>1 与 m-(m>>1) 的区别)#include#inclu...
分类:
其他好文 时间:
2015-02-04 00:16:20
阅读次数:
269
Android开发中注意到的几个问题
1、 关于actionbar
初始化配置actionbar,getactionbar经常为null,原因是因为在源码或者布局文件中设置了全屏显示的缘故,不设置全屏显示就不会有问题。
2、 关于textview
Textview默认是没有焦点的,因此不可能有点击事件,也无法直接实现背景的selector。通过设置an...
分类:
移动开发 时间:
2015-02-03 23:09:58
阅读次数:
434
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.
For example:
Given the below binary tree and su...
分类:
其他好文 时间:
2015-02-03 23:08:01
阅读次数:
196