bzoj3404
题解:
博弈论
然而我直接暴力dp
代码:
#include<bits/stdc++.h>
using namespace std;
const int N=;
int f[N],n,T;
void init()
{
f[]=;
for (int i=;i<N;i++)
{
int j=i,Min=,Max=;
while (j)
{
if (j%!=)
{
Max=max(j%,Max);
Min=min(j%,Min);
}
j/=;
}
if (Min!=&&!f[i-Min])f[i]=;
if (Max!=&&!f[i-Max])f[i]=;
}
}
int main()
{
init();
scanf("%d",&T);
while (T--)
{
scanf("%d",&n);
if (f[n])puts("YES");
else puts("NO");
}
}
bzoj3404的更多相关文章
- BZOJ3404: [Usaco2009 Open]Cow Digit Game又见数字游戏
3404: [Usaco2009 Open]Cow Digit Game又见数字游戏 Time Limit: 3 Sec Memory Limit: 128 MBSubmit: 47 Solved ...
- 【博弈论】【SG函数】bzoj3404 [Usaco2009 Open]Cow Digit Game又见数字游戏
#include<cstring> #include<cstdio> #include<algorithm> #include<set> using n ...
- 8.8-8.10 usaco
summary:44 没救了...整天刷水迟早药丸! ❤bzoj3892: 区间dp.我原来的思路是dp[i][j]表示前i个数跳过了j次,那么转移可以前k个数转移了j-1次,枚举k就好了,但是这样是 ...
随机推荐
- JRebel for IntelliJ 热部署破解方法
1.打开idea,然后打开设置. 2.点击Plugins 3.重启之后点击 4.下载激活JRebel的插件,下载地址:https://github.com/ilanyu/ReverseProxy/re ...
- openwrt的编译方法
1.获取最新包 ./scripts/feeds update -a 2.安装包 ./scripts/feeds install -a 3.配置 make menuconfig 4.编译 make -j ...
- BZOJ3297: [USACO2011 Open]forgot DP+字符串
Description 发生了这么多,贝茜已经忘记了她cowtube密码.然而,她记得一些有用的信息.首先,她记得她的密码(记为变 量P)长度为L(1 <= L<=1,000)字符串,并可 ...
- [bzoj1571][Usaco2009 Open]滑雪课Ski
题目描述 Farmer John 想要带着 Bessie 一起在科罗拉多州一起滑雪.很不幸,Bessie滑雪技术并不精湛. Bessie了解到,在滑雪场里,每天会提供S(0<=S<=100 ...
- each遍历小结
JQ中的遍历函数 (逐个加工函数) 格式: $(‘.box p’).each(function(index,element){ })也可以写成 $.each(‘.box p’,function(ind ...
- Facebook广告API系列 Business Manager
Facebook广告API系列 Business Manager Business Manager,是个很牛叉的东西,有多牛叉呢? 因为facebook已经越来越商业化了,上面的每个账号,页面,往往都 ...
- UVa 10201 Adventures in Moving - Part IV
https://vjudge.net/problem/UVA-10201 题意: 给出到达终点的距离和每个加油站的距离和油费,初始油箱里有100升油,计算到达终点时油箱内剩100升油所需的最少花费. ...
- RN的第一个API-----注册组件Appregistry
首先解释下AppRegistry是JS运行所有React Native应用的入口 什么是入口? 1.在我们初始化一个react native项目的时候 默认的index.ios.js/index.i ...
- 关于Mybatis 的 Mapped Statements collection does not contain value for 异常 解决方案
查看堆栈信息: at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:595) at org.apac ...
- shell while 语句
普通循环格式: while condition do command done 例子一 #!/bin/bash )) do echo $int let "int++" done 结 ...