hdu 2873 Bomb Game 博弈论】的更多相关文章

SG函数打表,求NIM和!!! 代码如下: #include<cstdio> #include<cstring> #include<iostream> #include<cmath> #include<algorithm> using namespace std; ][]; ]; void init() { int i,j,a,b,k; ]; ;i<=;i++){ sg[i][]=sg[][i]=i; } ;i<=;i++) ;j&l…
p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-size: 10.5000pt } h1 { margin-top: 5.0000pt; margin-bottom: 5.0000pt; text-align: center; font-family: 宋体; color: rgb(26,92,200); font-weight: bold; fo…
hdu 3555 Bomb 题意: 在1~N(1<=N<=2^63-1)范围内找出含有 ‘49’的数的个数: 与hdu 2089 不要62的区别:2089是找不不含 '4'和 '62'的区间范围内的数,此题是含有:正好相反,对于 "不要62"只是用第二位表示首位数字,这一题呢? 看转化:易知一定要要知道首位是9的个数,才能在前面加4得到 '49',但是什么状态能从不含 '49'转移到含 '49'?直接在不含'49'前加9,那么就出现了三个状态之间的递推转化,从而推出了第二维…
HDU 3622 Bomb Game 题目链接 题意:求一个最大半径,使得每一个二元组的点任选一个,能够得到全部圆两两不相交 思路:显然的二分半径,然后2-sat去判定就可以 代码: #include <cstdio> #include <cstring> #include <cstdlib> #include <vector> #include <cmath> #include <algorithm> using namespace…
HDU.2149 Public Sale (博弈论 巴什博弈) 题意分析 巴什博奕裸题 博弈论快速入门 代码总览 #include <bits/stdc++.h> using namespace std; int main() { int n,m,s,r; while(scanf("%d %d",&m,&n) != EOF){ s = m%(n+1); if(s == 0) printf("none\n"); else{ r = (m -…
HDU.1846 Brave Game (博弈论 巴什博弈) 题意分析 巴什博奕裸题 博弈论快速入门 代码总览 include <bits/stdc++.h> using namespace std; int main() { int t; scanf("%d",&t); while(t--){ int n,m; scanf("%d %d",&n,&m); int r,s; r = n%(m+1); if(r == 0) prin…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=3555 Bomb Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others) 问题描述 The counter-terrorists found a time bomb in the dust. But this time the terrorists improve on the time bo…
朋友 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Description B君在围观一群男生和一群女生玩游戏,具体来说游戏是这样的:给出一棵n个节点的树,这棵树的每条边有一个权值,这个权值只可能是0或1. 在一局游戏开始时,会确定一个节点作为根.接下来从女生开始,双方轮流进行 操作.当一方操作时,他们需要先选择一个不为根的点,满足该点到其父亲的边权为1; 然…
Bomb Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10    Accepted Submission(s): 3 Problem Description There are N bombs needing exploding.Each bomb has three attributes: exploding radius ri,…
Circles Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5299 Description There are n circles on a infinitely large table.With every two circle, either one contains another or isolates from the other.They are never crossed nor tangent. Alice and…
Bomb Game Time Limit: 10000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5396    Accepted Submission(s): 1925 Problem Description Robbie is playing an interesting computer game. The game field is an unbounde…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3555 Problem Description The counter-terrorists found a time bomb in the dust. But this time the terrorists improve on the time bomb. The number sequence of the time bomb counts from 1 to N. If the curre…
Bomb Game Time Limit: 10000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2951    Accepted Submission(s): 984 Problem Description Robbie is playing an interesting computer game. The game field is an unbounded…
Bomb Problem Description There are N bombs needing exploding.Each bomb has three attributes: exploding radius ri, position (xi,yi) and lighting-cost ci which means you need to pay ci cost making it explode.If a un-lighting bomb is in or on the border…
题意 求区间[1,n]内含有相邻49的数. 思路 比较简单的按位DP思路.这是第一次学习记忆化搜索式的数位DP,确实比递推形式的更好理解呐,而且也更通用~可以一般化: [数位DP模板总结] int dfs(int pos, int pre, int flag, bool limit) { if (pos == -1) return flag==target_flag; if (!limit && ~dp[pos][pre][flag]) return dp[pos][pre][flag];…
很简单的博弈论问题,可以转化为Nim 代码如下: #include<iostream> #include<stdio.h> #include<algorithm> #include<iomanip> #include<cmath> #include<cstring> #include<vector> #define ll __int64 #define pi acos(-1.0) #define MAX 50000 usi…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3555 题目大意:从0开始到给定的数字N所有的数字中遇到“49”的数字的个数. Sample Input 3 1 50 500   Sample Output 0 1 15 Hint From 1 to 500, the numbers that include the sub-sequence "49" are "49","149","24…
Bomb Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 11804    Accepted Submission(s): 4212 Problem Description The counter-terrorists found a time bomb in the dust. But this time the terrorist…
[题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=5724 [题目大意] 给出一个n行,每行有20格的棋盘,棋盘上有一些棋子,每次操作可以选择其中一个棋子,将其移至最左端的空位,两个人轮流操作,无法操作者输,判断游戏胜负. [题解] 首先对于单行20格的游戏,这是一个NIM游戏,将20格的情况状态压缩,对于每种情况递归求其mex集合,计算其sg值,sg值为0的状态为必败态. 而对于可以拆分为多组NIM游戏的游戏,其sg值为拆分出的多组游戏的sg值的…
Bomb Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 15102    Accepted Submission(s): 5452 Problem Description The counter-terrorists found a time bomb in the dust. But this time the terrorists…
Bomb Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 7926    Accepted Submission(s): 2780 Problem Description The counter-terrorists found a time bomb in the dust. But this time the terrorists…
http://acm.hdu.edu.cn/showproblem.php?pid=3404 题目 http://www.doc88.com/p-5098170314707.html 论文 nim积在22页附近 http://blog.csdn.net/kele52he/article/details/77099890 抄的代码的来源 根据论文相关部分和自己的理解的介绍.(nim积其实没什么卵用,学这种毒瘤的都有猫病.) nim和其实就是异或,想一下之前sg函数或者nim游戏结算的时候,是几堆在…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3555 题意:上一题是不要62 这个是"不要49" 代码: #include <stdio.h> #include <ctime> #include <math.h> #include <limits.h> #include <complex> #include <string> #include <functio…
链接: https://vjudge.net/problem/HDU-3555 题意: The counter-terrorists found a time bomb in the dust. But this time the terrorists improve on the time bomb. The number sequence of the time bomb counts from 1 to N. If the current number sequence includes…
Bomb Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 24148    Accepted Submission(s): 9092 Problem Description The counter-terrorists found a time bomb in the dust. But this time the terrorist…
Bomb Game Time Limit: 10000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3881    Accepted Submission(s): 1346 Problem Description Robbie is playing an interesting computer game. The game field is an unbounded…
Description \(n\) 个炸弹,每个炸弹有两个放置点,可以任选一个,问你最大的半径是多少. Sol 二分+2-SAT+Tarjan. 首先二分一下答案.然后就成了一个2-SAT问题. 建模就是, \(i\) 如果和 \(j\) 的距离超过 \(x*2\),那么 \(i\) 只能选择 \(j\) ^ \(1\) 连边,同时 \(j\) 只能选择 \(i\) ^ \(1\) 连边. 最后用Tarjan所以下环,如果两个点在一个环中,那么就不合法. Code #include <bits/…
题意:有一个游戏,有n个回合,每回合可以在指定的2个区域之一放炸弹,炸弹范围是一个圈,要求每回合的炸弹范围没有重合.得分是炸弹半径最小的值.求可以得到的最大分数. 思路:二分+2SAT. 二分炸弹范围,再根据有无重合建图,用2SAT判定. #include <cstdio> #include <cmath> #include <vector> #include <cstring> using namespace std; ; struct TwoSAT {…
RT. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ],ret=,dp[][][]; void get_bit(long long x) { ret=; ;x/=;} } long long dfs(long long pos,long long pre,bool flag1,long long flag2) {…
给出n,问所有[0,n]区间内的数中,不含有49的数的个数 数位dp,记忆化搜索 dfs(int pos,bool pre,bool flag,bool e) pos:当前要枚举的位置 pre:当前要枚举的位置的前面是否为4 flag:枚举当前时,这个数的49时候被算过了 e:当前位置是否可以随便取值 dp[pos][pre][flag] #include<cstdio> #include<cstring> #include<algorithm> #include<…