第一种思路是:
dp(i):到位置i所需要的最少步数
dp(i)一定是递增的,所以从j=A[i]开始(从最远的位置开始),更新数组直到dp(j+i)
如果去掉,会TLE
int jump(int A[], int n) {
int* dp = new int[n];//dp[i]到i所需的最小步数
memset(dp, 0x3f, sizeof(int)...
分类:
其他好文 时间:
2014-09-16 01:38:29
阅读次数:
241
simple.data是一个轻量级的、动态的数据访问组件,支持.net4.0。1、必须条件和依赖性:v4.0 or greater of the .NET framework, orv2.10 or greater of the Mono framework项目中引用Simple.Data.Core...
分类:
其他好文 时间:
2014-09-16 01:33:29
阅读次数:
257
HDU 1846 Brave Game (巴什博弈)Description十年前读大学的时候,中国每年都要从国外引进一些电影大片,其中有一部电影就叫《勇敢者的游戏》(英文名称:Zathura),一直到现在,我依然对于电影中的部分电脑特技印象深刻。 今天,大家选择上机考试,就是一种勇敢(brave)的...
分类:
其他好文 时间:
2014-09-15 22:47:29
阅读次数:
330
---恢复内容开始---参考:http://www.cnblogs.com/youxin/p/3967274.htmlhttp://scotch.io/tutorials/simple-laravel-crud-with-resource-controllershttp://www.tuicool....
题目地址:POJ 2484
很简单的智力题。。。当n>4时候,后手方完全可以根据剩下的奇偶情况使得剩下了偶数个并且对称,然后每当先手出一次,后手就可以模仿着先手在对称的地方出一次,这样的话,后方是必胜的。
代码如下:
#include
#include
#include
#include
#include
#include
#include
#include
#include...
分类:
其他好文 时间:
2014-09-15 21:25:49
阅读次数:
273
# include
# include
# include
# include
# include
using namespace std;
int main()
{
int n,m,i,a,b,cot;
while(~scanf("%d%d",&n,&m))
{
cot=0;
for(i=0; i<n; i++)
...
分类:
其他好文 时间:
2014-09-15 21:22:29
阅读次数:
268
Problem Description
Here is a game for two players. The rule of the game is described below:
● In the beginning of the game, there are a lot of piles of beads.
● Players take turns to play. ...
分类:
其他好文 时间:
2014-09-15 21:21:29
阅读次数:
202
题目地址:POJ 2348
每一步只有如下三种情况:(假设a>=b)
1:a%b==0 这时候自然是必败态。
2:a
3:a>2*b 这时候是必胜态。为什么呢?因为此时总可以转移到一个必败态。由于第2情况的时候两种状态是交替的,而这时候由总可以转换成(a,a%b)和(a,a%b+b),而(a,a%b+b)与(a,a%b)又属于第2种情况的相邻的,所以必有一个是必败态。根据只要能达到...
分类:
其他好文 时间:
2014-09-15 21:19:29
阅读次数:
206
Game
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 263 Accepted Submission(s): 205
Problem Description
Here is a game for two ...
分类:
其他好文 时间:
2014-09-15 19:30:49
阅读次数:
162
n堆珠子,每次选一堆至少取一个,然后可以选择是否把这堆剩下的分为任意的a,b两部分,谁先取完谁赢,问先手的是否能获胜。
#include
#include
#include
#include
#include
#include
using namespace std;
int n;
int main()
{
int x;
int ans;
while(scanf("%d",&n...
分类:
其他好文 时间:
2014-09-15 17:52:09
阅读次数:
171