题目:uva10404 - Bachet's Game(博弈,递推)
题目大意:stan和ollie两个小伙伴在玩石头的游戏:给出N个石头,然后给出Mge数。要求每次都是stan先开始,每次拿走m (是M个数中的其中一个)个石头。谁拿走石头后桌上没有剩下石头就赢了。
解题思路:博弈。对于j和石头,stan想要赢的话那么就要分奇数次将j石头拿走。...
分类:
其他好文 时间:
2014-08-03 20:38:05
阅读次数:
234
给出两个等长的字符串,每次需要改变m个数字,每次必须改变k个数字,求从第一个串变化到第二个串的方案数。DP。f[i][j]改变i步后,有j个位置被改变的方案数。然后直接枚举当前改变的几个位置是前面重合的。然后统计答案输出即可。#include #include #include #define M ...
分类:
其他好文 时间:
2014-08-03 20:26:35
阅读次数:
213
A Simple Problem with IntegersTime Limit:5000MS Memory Limit:131072KCase Time Limit:2000MSDescriptionYou haveNintegers,A1,A2, ... ,AN. You need to d.....
分类:
其他好文 时间:
2014-08-03 17:59:25
阅读次数:
213
#include#include#include#includeusing namespace std;int pieces[10][10];int ans[16];int res[4][4];int Min=1000000;const int INF=1=0) res...
分类:
其他好文 时间:
2014-08-03 15:14:55
阅读次数:
228
Description
You have N integers, A1, A2, ... ,
AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other ...
分类:
其他好文 时间:
2014-08-03 12:53:25
阅读次数:
311
Description
In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same lengt...
分类:
其他好文 时间:
2014-08-03 10:18:05
阅读次数:
265
题目链接:uva 1521 - GCD Guessing Game
题目大意:给定一个数N,现在又一个数x,在1~N之间,现在每次可以猜一个数a,返回gcd(x,a),问说最少猜几次可以确定x。
解题思路:其实就将1~N里面的素数都要考虑一遍,因为有一个N的限制,所以每次选出来的素数的积不大于N即可。
#include
#include
#include
using name...
分类:
其他好文 时间:
2014-08-02 23:27:44
阅读次数:
302
Problem Description
PusherBoy is an online game http://www.hacker.org/push . There is an R * C grid, and there are piles of blocks on some positions. The goal is to clear the blocks by pushing into t...
分类:
其他好文 时间:
2014-08-02 23:27:34
阅读次数:
342
Description
The puzzle game of Sudoku is played on a board of N2 × N2 cells. The cells are grouped in N × N squares of N × N cells each. Each cell is either empty or contains a number between
1 a...
分类:
其他好文 时间:
2014-08-02 23:26:34
阅读次数:
344
1、简单工厂模式简介1.1>、定义 简单工厂模式定义一个Factory类,可以根据参数的不同返回不同类的实例,被创建的实例通常有共同的父类。 简单工厂模式只需要一个Factory类。 简单工厂模式又称为静态工厂模式,Factory类为静态类或包含静态方法。1.2>、使用频率 中2、简单工厂模...
分类:
其他好文 时间:
2014-08-02 23:24:58
阅读次数:
211