博弈论之组合博弈
oranges_c
落寞是岁月的痕迹
展开
-
【HDU1536】S-Nim(博弈)
大致题意: 给你一个a数组 每次可以取a[i]个,q次询问,每次询问 共有m堆,因为sg函数是一堆的,所以将每堆的sg值异或就是答案。#include <bits/stdc++.h> using namespace std; const int maxn = 10000 + 10; int s[110]; int sg[maxn]; bool Hash[maxn]; /原创 2016-08-08 10:20:17 · 292 阅读 · 0 评论 -
【HDU1847】Good Luck in CET-4 Everybody!(博弈)
记录一个菜逼的成长。。 简单博弈 暴力打表 只能取2的幂次#include <cstdio> #include <iostream> #include <cstring> #include <string> #include <algorithm> #include <cstdlib> #include <vector> #include <set> #include <map> #include原创 2016-08-08 10:22:05 · 271 阅读 · 0 评论 -
【HDU5795】 A Simple Nim(博弈)
sg[0]=0当x=8k+7时sg[x]=8k+8,当x=8k+8时sg[x]=8k+7,其余时候sg[x]=x;(k>=0)打表找规律可得,数学归纳法可证。#include <cstdio> #include <iostream> #include <cstring> #include <string> #include <algorithm> #include <cstd原创 2016-08-08 10:23:24 · 267 阅读 · 0 评论 -
【51NOD1135】原根(数论)
感谢ACdreamer1135 原根 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 设m是正整数,a是整数,若a模m的阶等于φ(m),则称a为模m的一个原根。(其中φ(m)表示m的欧拉函数) 给出1个质数P,找出P最小的原根。 Input输入1个质数P(3 <= P <= 10^9)Output输出P最小的原根。Input示例3Output示例2原创 2016-12-27 12:21:48 · 686 阅读 · 0 评论 -
ECPC16-A.The game of Osho(博弈)
题目链接题目大意: 有T组数据 给你G个子游戏,每个子游戏有一个数n,两个人轮流可以减去b的幂次,前提是小于等于n。不能再减就算输。 问最后谁赢。打sg表找规律。。 多个子游戏 ,则结果异或。#include <cstdio> #include <iostream> #include <cstring> #include <algorithm> using names原创 2017-03-09 17:03:31 · 419 阅读 · 0 评论 -
【TOJ4172】I-The dynamic programming problem1(博弈)
题目链接 题目大意: 给你一个n长的01串,每次可以用一个0去替代连续的两个1的字符 Alice先手,谁不能替代谁就输。打sg表。 假设现在有一个kk长的连续的11串 1112...1k−11k1_11_2...1_{k-1}1_k 它的上一个状态就是从中去掉两个连续的1后的两个子状态的异或 假设从j(0≤j≤k−2)j(0 \leq j \leq k-2)的位原创 2017-07-13 11:16:54 · 256 阅读 · 0 评论