1~9显然,后面平\(A\)过去

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#define R(a,b,c) for(register int a = (b); a <= (c); ++a)
#define nR(a,b,c) for(register int a = (b); a >= (c); --a)
#define Fill(a,b) memset(a, b, sizeof(a))
#define Swap(a,b) ((a) ^= (b) ^= (a) ^= (b)) #define ON_DEBUGG #ifdef ON_DEBUGG #define D_e_Line printf("-----------\n")
#define D_e(x) std::cout << (#x) << " : " <<x << "\n"
#define FileOpen() freopen("in.txt", "r", stdin)
#define FileSave() freopen("out2.txt", "w", stdout)
#define Pause() system("pause")
#include <ctime>
#define TIME() fprintf(stderr, "\nTIME : %.3lfms\n", clock() * 1000.0 / CLOCKS_PER_SEC) #else #define D_e_Line ;
#define D_e(x) ;
#define FileOpen() ;
#define FilSave ;
#define Pause() ;
#define TIME() ; #endif struct ios {
template<typename ATP> ios& operator >> (ATP &x) {
x = 0; int f = 1; char c;
for(c = getchar(); c < '0' || c > '9'; c = getchar()) if(c == '-') f = -1;
while(c >= '0' && c <= '9') x = x * 10 + (c ^ '0'), c = getchar();
x *= f;
return *this;
}
}io; using namespace std; template<typename ATP> inline ATP Min(ATP a, ATP b) {
return a < b ? a : b;
}
template<typename ATP> inline ATP Max(ATP a, ATP b) {
return a > b ? a : b;
}
template<typename ATP> inline ATP Abs(ATP a) {
return a < 0 ? -a : a;
} const int N = 1000007; int maxx, minn;
inline void Calc(int n) {
while(n){
int tmp = n % 10;
maxx = Max(maxx, tmp);
if(tmp) minn = Min(minn, tmp);
n /= 10;
}
} int f[N]; int main() {
R(i,1,9) f[i] = true;
R(i,10,N - 5){
maxx = 0, minn = 10;
Calc(i);
if(!(f[i - maxx] && f[i - minn]))
f[i] = true;
}
int Tasks;
io >> Tasks;
while(Tasks--){
int n;
io >> n;
if(f[n])
printf("YES\n");
else
printf("NO\n");
}
return 0;
}

LuoguP2953 [USACO09OPEN]牛的数字游戏Cow Digit Game(博弈论)的更多相关文章

  1. 洛谷 2953 [USACO09OPEN]牛的数字游戏Cow Digit Game

    洛谷 2953 [USACO09OPEN]牛的数字游戏Cow Digit Game 题目描述 Bessie is playing a number game against Farmer John, ...

  2. [USACO09OPEN]牛的数字游戏Cow Digit Game 博弈

    题目描述 Bessie is playing a number game against Farmer John, and she wants you to help her achieve vict ...

  3. 【Luogu】P2953牛的数字游戏(博弈论)

    题目链接 自己乱搞……然后一遍AC啦! 思路从基本的必胜态和必败态开始分析.我们把减去最大数得到的数叫作Max,减去最小数得到的数叫作Min. 那么开始分析. 一.0是必败态. 这个没法解释.题目就这 ...

  4. 洛谷 [P2953] 牛的数字游戏

    SG搜索 n的范围在可以接受的范围内,SG搜索即可 #include <iostream> #include <cstdio> #include <cstring> ...

  5. BZOJ3404: [Usaco2009 Open]Cow Digit Game又见数字游戏

    3404: [Usaco2009 Open]Cow Digit Game又见数字游戏 Time Limit: 3 Sec  Memory Limit: 128 MBSubmit: 47  Solved ...

  6. 3404: [Usaco2009 Open]Cow Digit Game又见数字游戏

    3404: [Usaco2009 Open]Cow Digit Game又见数字游戏 Time Limit: 3 Sec  Memory Limit: 128 MBSubmit: 72  Solved ...

  7. 【BZOJ】3404: [Usaco2009 Open]Cow Digit Game又见数字游戏(博弈论)

    http://www.lydsy.com/JudgeOnline/problem.php?id=3404 写挫好几次.... 裸的博弈论即可.. #include <cstdio> #in ...

  8. BZOJ1666: [Usaco2006 Oct]Another Cow Number Game 奶牛的数字游戏

    1666: [Usaco2006 Oct]Another Cow Number Game 奶牛的数字游戏 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 5 ...

  9. bzoj:1666: [Usaco2006 Oct]Another Cow Number Game 奶牛的数字游戏

    Description 奶牛们又在玩一种无聊的数字游戏.输得很郁闷的贝茜想请你写个程序来帮她在开局时预测结果.在游戏的开始,每头牛都会得到一个数N(1<=N<=1,000,000).此时奶 ...

随机推荐

  1. JavaScript正则中//g, g 的作用

    //正则表达式的标准写法regexp = new RegExp(pattern[, flag]); pattern:  模板的用法是关键,也是本章的主要内容.    flag:     "i ...

  2. 20212115 实验三 《python程序设计》实验报告

    实验报告 20212115<python程序设计>实验三报告 课程:<Python程序设计>班级: 2121姓名: 朱时鸿学号:20212115实验教师:王志强老师实验日期:2 ...

  3. 【雅礼集训 2017 Day2】棋盘游戏

    loj 6033 description 给一个\(n*m\)的棋盘,'.'为可通行,'#'为障碍.Alice选择一个起始点,Bob先手从该点往四个方向走一步,Alice再走,不能走走过的点,谁不能动 ...

  4. linux-ext4格式文件误删除,该如何恢复?

    在开始进行实验之前,我已经新建了一个空目录/data,并将该目录挂载了一块新硬盘,将硬盘分区格式化为ext4的格式,所以当我操作/data目录下的文件及文件夹的时候,实际上就是针对新挂载的硬盘进行数据 ...

  5. “摆地摊“都找不到全栈工程师?JNPF帮你分分钟搞定!

    大街上捕捉野生程序员 都这样了还找不到全栈工程师 全栈工程师(Full-Stack Engineer)图鉴: 全栈工程师,也叫全端工程师(同时具备前端和后台能力),英文Full Stack  deve ...

  6. SCSS 简要教程(常用指令与方法)

    Sass是成熟.稳定.强大的CSS预处理器,而SCSS是Sass3版本当中引入的新语法特性,完全兼容CSS3的同时继承了Sass强大的动态功能. 特性概览 CSS书写代码规模较大的Web应用时,容易造 ...

  7. 测试人生 | 薪资翻倍涨至50W是种什么样的体验?

    本文为霍格沃兹测试开发学社优秀学员跳槽笔记,测试开发进阶学习文末加群. 本人已经工作7年了,做的都是功能测试以及写一些简单的自动化脚本,加上之前没有学习的意识,导致专业技术水平与工作年限不匹配,在上家 ...

  8. Docker-配置华为云加速

    到网址点击立即使用 https://www.huaweicloud.com/intl/zh-cn/product/swr.html 登录后进入镜像服务 按要求操作即可 相关命令 vi /etc/doc ...

  9. HashMap的实现原理?如何保证HashMap线程安全?

    A:HashMap简单说就是它根据建的hashcode值存储数据的,大多数情况下可以直接定位到它的值,因而具有很快的访问速度,但遍历的顺序是不确定的. B:HashMap基于哈希表,底层结构由数组来实 ...

  10. label问题排查:打不开标注好的图像

    问题描述 之前标注好的文件,标注有bbox和若干points.选择Open Dir打开图像目录,选择Change Output Dir选择json文件所在目录.发现有些图片能正常显示标注后的状态.而有 ...