题目:
Given a linked list, remove the nth node from the end of list and return its head.
For example,
Given linked list: 1->2->3->4->5, and n = 2.
After removing the second node fr...
分类:
其他好文 时间:
2014-08-28 18:12:35
阅读次数:
289
Description
The funny stone game is coming. There are n piles of stones, numbered with
0, 1, 2,..., n - 1. Two persons pick stones in turn. In every turn, each person selects three piles of stones...
分类:
其他好文 时间:
2014-08-28 16:15:29
阅读次数:
523
Stone Game
Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 2539 Accepted Submission(s): 741
Problem Description
This game is a two-p...
分类:
其他好文 时间:
2014-08-27 22:03:38
阅读次数:
244
http://poj.org/problem?id=1740题目大意就是,对于n堆石子,每堆若干个,两人轮流操作,每次操作分两步,第一步从某堆中去掉至少一个,第二步(可省略)把该堆剩余石子的一部分分给其它的某些堆。最后谁无子可取即输。看了题解感觉太神了。首先我们来分析:当只有一堆时,先手必胜,直接一...
分类:
其他好文 时间:
2014-08-27 14:23:28
阅读次数:
261
看数据规模,也懒得想了,裸DFS得了 1 import java.util.Scanner; 2 3 public class P1005 4 { 5 private static int best = Integer.MAX_VALUE; 6 7 //a[] 原始值 8 ...
分类:
其他好文 时间:
2014-08-26 01:41:55
阅读次数:
362
Calcium powder(Heavy Gaifenpowder) applies to be fillers for various products, for example artificial stone, artificial floor tiles, organic rubber, s...
分类:
其他好文 时间:
2014-08-20 12:24:32
阅读次数:
199
Problem DescriptionThere are a bunch of stones on the beach; Stone color is white or black. Little Sheep has a magic brush, she can change the color o...
分类:
其他好文 时间:
2014-08-20 12:11:22
阅读次数:
209
经典的约瑟夫环问题嘛。有点小小的变形而已。给你N个人围成一个环(编号1~N),从第M个人开始,每隔K个人报一次数,报数的人离开该环。
求最后剩下的人的编号。
约瑟夫问题的数学递推解法:
(1)第一个被删除的数为 (m - 1) % n。
(2)假设第二轮的开始数字为k,那么这n - 1个数构成的约瑟夫环为k, k + 1, k + 2, k +3, .....,...
分类:
其他好文 时间:
2014-08-20 00:05:35
阅读次数:
258
Stone
Time Limit: 3000/2000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others)
Total Submission(s): 2267 Accepted Submission(s): 568
Problem Description
Given an array of int...
分类:
其他好文 时间:
2014-08-18 18:34:42
阅读次数:
294
Description
You and your friend are playing a game in which you and your friend take turns removing stones from piles. Initially there are
N piles with a1,
a2, a3,..., aN number of stones. On eac...
分类:
其他好文 时间:
2014-08-17 11:46:42
阅读次数:
172