POJ 2505 A multiplication game [博弈]】的更多相关文章

题意:两个人做游戏,每个人都可以在自己的回合里将数p乘以2到9之间的一个数,初始时p=1,谁先将p乘到大于等于n就算赢. 思路:一开始我算sg值,结果算来算去都没算明白... 后来看了别人题解,才豁然开朗. 首先,对于一个数m,计算出p在什么范围内可以乘到大于等于m.该范围即为[ceil(m/9), m - 1].其中ceil()为向上取整.如果将每一个数字都看作一个局面的话,则在该区间内的点即为N点. 对于一个数m,计算出p在什么范围内只能乘到大于等于m.该范围即为[ceil(m/2), m…
A multiplication game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5622   Accepted: 2811 Description Stan and Ollie play the game of multiplication by multiplying an integer p by one of the numbers 2 to 9. Stan always starts with p =…
题目链接 #include<iostream> #include<cstdio> using namespace std; typedef long long ll; int main() { ll n; while(~scanf("%I64d",&n)) {//其实算是 贪心了吧 //先手想赢,他会x2,这样子才能尽量避免让后手赢 //后手想赢,他就会x9,只有乘最大的,他胜算才最大 ; ll l=,r=; ) { if(n>=l&&am…
题目 题意:两个人轮流玩游戏,Stan先手,数字 p从1开始,Stan乘以一个2-9的数,然后Ollie再乘以一个2-9的数,直到谁先将p乘到p>=n时那个人就赢了,而且轮到某人时,某人必须乘以2-9的一个数.1 < n < 4294967295 如果,n∈[2,9],那么stan必胜.[9] 如果,n∈[10,18],stan先手,只能给到[2,9]之间的数字.Stan不想让对方赢,所以最小给2,那么Olilie要让自己赢最大取9,最多能取到18:如果Stan给9,那么Olilie随便…
题目链接题意: 有一个数p=1,甲乙两人轮流操作,每次可以把p乘2~9中的一个数,给定一个n,当一个人操作后p>=n,那么这个人赢,问先手是否必胜. 必胜状态:存在一种走法走到一个必败状态. 必败状态:后继状态都为必胜状态. 我们可以知道>=n的数都为必败状态,可以转移到>=n的最小的数为n/9(上取整),所以 n/9~n-1都为必胜态,同理n/9/2(都为上取整)为最小的必须转移到n/9~n-1(必胜状态)的状态,所以n/9/2~n/9-1为必败态,于是就可以这样推到1,看一下1是必胜…
Cow Multiplication Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 13312   Accepted: 9307 Description Bessie is tired of multiplying pairs of numbers the usual way, so she invented her own style of multiplication. In her style, A*B is eq…
Football Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 451   Accepted: 178 Description Alice and Bob both love football very much, and both of them are vanguards. They are both good at football control. One day after a football ma…
Matrix Multiplication Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 18928   Accepted: 4074 Description You are given three n × n matrices A, B and C. Does the equation A × B = C hold true? Input The first line of input contains a posit…
Matrix Multiplication Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 17783   Accepted: 3845 Description You are given three n × n matrices A, B and C. Does the equation A × B = C hold true? Input The first line of input contains a posit…
http://poj.org/problem?id=3318 矩阵A*矩阵B是否等于矩阵C #include <cstdio> #include <cstring> #include <time.h> #include <algorithm> #define maxn 1010 using namespace std; int a[maxn][maxn],b[maxn][maxn],c[maxn][maxn],d[maxn]; int n; int b1[m…