题意:David 玩一个石子游戏。游戏中,有n堆石子,被编号为0..n-1。两名玩家轮流取石子。 每一轮游戏,每名玩家选取3堆石子i,j,k(i
解法:看上去是将石子都往右移,直到所有都到了n-1堆不能移为止。首先是考虑每堆石子其实是独立的一个子游戏,堆与堆之间不相互影响。然后就是个数是偶数的对不会影响必胜必败态,必败态无法通过移动偶数堆得石子来扭转局面,因为必胜者只需对称操作即可。所以每堆石子...
分类:
其他好文 时间:
2014-11-02 18:14:50
阅读次数:
224
Zhuge Liang's Stone Sentinel MazeTime Limit: 10000/4000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 385Accepted Subm...
分类:
其他好文 时间:
2014-10-31 15:05:48
阅读次数:
210
Frogger
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 26435
Accepted: 8603
Description
Freddy Frog is sitting on a stone in the middle of a lake. Suddenly ...
分类:
其他好文 时间:
2014-10-22 18:21:00
阅读次数:
306
这道题是NOIP第一道DP优化题,看似容易,实际上想要满分也颇有难度。
传送门:1002 过河
算法
此题显然要用到DP,DP方程也显而易见:
if (stone[i]) f[i]=min{f[i-j]}+1; (S
else f[i]=min{f[i-j]};
这样的时间复杂度为 O(LT) ,空间复杂度为 O(L) 。
而此题的L高达 10亿 ,所以这种朴素的方法只能得 30...
分类:
编程语言 时间:
2014-10-22 14:44:16
阅读次数:
309
Coding for removing servername from the views.--The following script is to find out the existing views of the database machine's displayUSE Database;S...
分类:
其他好文 时间:
2014-10-22 09:55:53
阅读次数:
195
奇偶排序:
第一轮扫描选择所有的奇数据项对,与相邻偶数比较,a[j]和a[j+1],j是奇数(j=1,3,5...), j
第二轮扫描选择所有的偶数据项对,与相邻奇数比较,a[j]和a[j+1],j是偶数(j=0,2,4...), j
奇偶排序的时间复杂度为O(N^2)
/**
* 奇偶排序
* @author stone
*
*/
public class OddEvenSor...
分类:
编程语言 时间:
2014-10-20 17:23:31
阅读次数:
244
DP: dp[i][j]前i堆排出j长度的序列有多少种排法,
dp[i][j]=dp[i-1][j] (不用第i堆),
dp[i][j]+=dp[i-1][j-k]*C[j][k] (用第i堆的k个石头)
A Famous Stone Collector
Time Limit: 30000/15000 MS (Java/Others) Memory Limit: 3...
分类:
其他好文 时间:
2014-10-18 12:40:59
阅读次数:
299
Frogger
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 26417
Accepted: 8592
Description
Freddy Frog is sitting on a stone in the middle of a lake. Sudde...
分类:
其他好文 时间:
2014-10-16 23:46:53
阅读次数:
239
题目链接:
https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=242&page=show_problem&problem=1669
Root :: Regionals
2006 :: Asia - Beijing
R...
分类:
其他好文 时间:
2014-10-16 14:52:12
阅读次数:
669
Wang Xifeng's Little Plot
Problem Description
《Dream of the Red Chamber》(also 《The Story of the Stone》) is one of the Four Great Classical Novels of Chinese literature, and it is commonly ...
分类:
其他好文 时间:
2014-10-14 21:15:09
阅读次数:
231