hdu 4388 Stone Game II】的更多相关文章

Stone Game II HDU - 4388 题目大意: 给出n堆物品,每堆物品都有若干件,现在A和B进行游戏,每人每轮操作一次,按照如下规则: 1. 任意选择一个堆,假设该堆有x个物品,从中选择k个,要保证0<k<x且0<(x^k)<k. 2. 再增加一个大小为x^k的堆(也就相当于将一个x个物品的堆变成一个k个物品的堆和一个x^k个物品的堆),另外有一个技能,可以将这个大小为x^k的堆变成(2*k)^x的堆,但是这个技能每个人只有一次机会可以使用. 现在问两人轮流操作,都采…
Stone Game II comes. It needs two players to play this game. There are some piles of stones on the desk at the beginning. Two players move the stones in turn. At each step of the game the player should do the following operations.   First, choose a p…
Stone Game II Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 531    Accepted Submission(s): 300 Problem Description Stone Game II comes. It needs two players to play this game. There are some p…
http://acm.hdu.edu.cn/showproblem.php?pid=4388 http://blog.csdn.net/y1196645376/article/details/52143551 好久没有写题了,再这么颓下去就要被彻底踩爆了(已经被彻底踩爆了). 这道题是一道博弈论,从侧面向我们揭示了一个客观规律,取东西的博弈论(不是定理的话)大多数都是从二进制入手(虽然这道题题目很显然是和二进制有关)进行一系列的找规律. 这道题的正解也同样给了我们一种看题的思路,从最基本的条件看…
Stone Game II Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 609    Accepted Submission(s): 350 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4388 Descripton: Stone Game II comes. It needs two…
HDU 3081 Marriage Match II pid=3081" target="_blank" style="">题目链接 题意:n个女孩n个男孩,每一个女孩能够和一些男孩配对.然后有些女孩是朋友.满足这个朋友圈里面的人,假设有一个能和某个男孩配对,其它就都能够,然后每轮要求每一个女孩匹配到一个男孩.且每轮匹配到的都不同,问最多能匹配几轮 思路:二分轮数k,然后建图为,源点连向女孩,男孩连向汇点容量都为k,然后女孩和男孩之间连边为.有关系的…
HDU 3081 Marriage Match II (网络流,最大流,二分,并查集) Description Presumably, you all have known the question of stable marriage match. A girl will choose a boy; it is similar as the game of playing house we used to play when we are kids. What a happy time as…
HDU 3081 Marriage Match II (二分图,并查集) Description Presumably, you all have known the question of stable marriage match. A girl will choose a boy; it is similar as the game of playing house we used to play when we are kids. What a happy time as so many…
Last Stone Weight II 欢迎关注H寻梦人公众号 You are given an array of integers stones where stones[i] is the weight of the ith stone. We are playing a game with the stones. On each turn, we choose any two stones and smash them together. Suppose the stones have…
Bone Collector II Time Limit: 5000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4178    Accepted Submission(s): 2174 Problem Description The title of this problem is familiar,isn't it?yeah,if you had took pa…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1212 Train Problem II Description As we all know the Train Problem I, the boss of the Ignatius Train Station want to know if all the trains come in strict-increasing order, how many orders that all the t…
Bone Collector II Time Limit: 5000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1334    Accepted Submission(s): 666 Problem Description The title of this problem is familiar,isn't it?yeah,if you had took par…
Bone Collector II Time Limit: 5000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4739    Accepted Submission(s): 2470 Problem Description The title of this problem is familiar,isn't it?yeah,if you had took pa…
Stone Game HDU - 1729 题意: 给定n个箱子,每个箱子的容量为si,每个箱子里最初有ci个石子,每次放入石子不能超过放入前的石子数的平方,谁无法继续放入石子就算输.   /* 这是个SG函数的基础题?并不是的吧.. 求一个t使t+t*t=si,那么 1.当ci>t时,是必胜态,可以一次性放满箱子,即(si,si). 2.当ci==t时,即便只放一个,下一个状态t+1+(t+1)*(t+1)一定能放满箱子必胜,所以ci==t这个状态必败. 3.当ci=si-t,同样的方法判断必…
Mart Master II Time Limit: 6000ms Memory Limit: 65536KB This problem will be judged on HDU. Original ID: 501664-bit integer IO format: %I64d      Java class name: Main Trader Dogy lives in city S, which consists of n districts. There are n - 1 bidire…
Matrix Swapping II Time Limit: 9000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1430    Accepted Submission(s): 950 Problem Description Given an N * M matrix with each entry equal to 0 or 1. We can find som…
Bone Collector II Time Limit: 5000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3355    Accepted Submission(s): 1726 Problem Description The title of this problem is familiar,isn't it?yeah,if you had took par…
http://acm.hdu.edu.cn/showproblem.php?pid=2236 题意:中文题意. 思路:先找出最大和最小值,然后二分差值,对于每一个差值从下界开始枚举判断能不能二分匹配. #include <cstdio> #include <algorithm> #include <iostream> #include <cstring> #include <string> #include <cmath> #incl…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4764 题目大意:Tang和Jiang玩石子游戏,给定n个石子,每次取[1,k]个石子,最先取完的人失败,Tang先取,求博弈. Sample Input 1 1 30 3 10 2 0 0   Sample Output Jiang Tang Jiang 分析:可以看成是谁先取完n-1个石子,谁获胜,则变成完完全全的巴什博弈,当然要考虑特殊情况. 代码如下: #include<iostream>…
3081 意甲冠军: n女生选择不吵架,他甚至男孩边(他的朋友也算.并为您收集过程).2二分图,一些副作用,有几个追求完美搭配(每场比赛没有重复的每一个点的比赛) 后.每次增广一单位,(一次完美匹配),再改动起点还有终点的边流量,继续增广.直到达不到完美匹配为止.网上非常多是用二分做的,我认为不是必需. .. (网上传播跟风真严重.. . 非常多人都不是真正懂最大流算法的... ) 3277 : 再附加一条件,每一个女孩能够最多与k个自己不喜欢的男孩. 求有几种完美匹配(同上). 我认为:求出上…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6149 题意:中文题目 解法:状压DP,dp[i][j]代表前i个低点,当前高点状态为j的方案数,然后枚举转移就好了,我的代码里为什么要用滚动优化,内存?内存是足够的,不需要优化,我的dp表示是前i个低点所以转移不是从i-1转移,是从前一个低点转移,所以滚动数组能完美解决这个问题. #include <bits/stdc++.h> using namespace std; typedef long…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4764 题意:Tang 和 Jiang 玩一个游戏,轮流写下一个数,Tang先手,第一次Tang只能写[1,k]之间的数,X表示上一个人写的数,Y表示下一个人写的数,每次必须满足 1<=Y-X<=k,直到有一个人写下的数不小于n,写下那个数的人失败,游戏结束,输出胜利的人. 分析:可以看做是取石子游戏,有一堆n-1个的石子,两个人轮流去石子,每次最多能去k个,如果没有石子可取则输,这就将问题转化为巴…
Stone Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 179    Accepted Submission(s): 137 Problem Description Tang and Jiang are good friends. To decide whose treat it is for dinner, they are pla…
Train Problem II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4358    Accepted Submission(s): 2391 Problem Description As we all know the Train Problem I, the boss of the Ignatius Train Stati…
题目链接 Problem Description The title of this problem is familiar,isn't it?yeah,if you had took part in the "Rookie Cup" competition,you must have seem this title.If you haven't seen it before,it doesn't matter,I will give you a link: Here is the l…
The title of this problem is familiar,isn't it?yeah,if you had took part in the "Rookie Cup" competition,you must have seem this title.If you haven't seen it before,it doesn't matter,I will give you a link: Here is the link: http://acm.hdu.edu.c…
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=3081 题意 有n对男女 女生去选男朋友 如果女生从来没和那个男生吵架 那么那个男生就可以当她男朋友 女生也可以选择从来没和自己闺蜜吵过架的男生当男朋友 如果 女生A和女生B是闺蜜 女生A和男生C吵过架 但是女生B和男生C从来没吵过架 那么女生A是可以选择男生C当男朋友的. 看来 讨好闺蜜是一件多么重要的事情.. T T组数据 给出 n, m, f 有N对男女, m对从未吵架关系 f 对闺蜜关系 思路…
3081 题意: n个女孩选择没有与自己吵过架的男孩有连边(自己的朋友也算,并查集处理),2分图,有些边,求有几种完美匹配(每次匹配每个点都不重复匹配) 我是建二分图后,每次增广一单位,(一次完美匹配),再修改起点还有终点的边流量,继续增广,直到达不到完美匹配为止.网上很多是用二分做的,我觉得没必要...(网上传播跟风真严重...很多人都不是真正懂最大流算法的...) 3277 : 再附加一条件,每个女孩可以最多与k个自己不喜欢的男孩.求有几种完美匹配(同上). 我觉得:求出上题答案,直接ans…
题目地址:pid=5016">HDU 5016 先两遍DFS预处理出每一个点距近期的基站的距离与基站的编号. 然后找重心.求出每一个点距重心的距离.然后依据dis[x]+dis[y] < d[y].用二分找出当前子树中不会被占据的数量,总点数减去即是被占据的数量. 这样就能够求出每一个点最多占据的点的数量.然后找最大值就可以. 代码例如以下: #include <iostream> #include <string.h> #include <math.h…
Marriage Match II 题意:有n个男生,n个女生,现在有 f 条男生女生是朋友的关系, 现在有 m 条女生女生是朋友的关系, 朋友的朋友是朋友,现在进行 k 轮游戏,每轮游戏都要男生和女生配对,每轮配对过的人在接下来中都不能配对,求这个k最大是多少. 题解:二分 + 网络流check . 代码: #include<bits/stdc++.h> using namespace std; #define Fopen freopen("_in.txt","…