poj2368 Buttons
题解:
非常简单的巴什博弈问题。
简单来说保证$L+1$是$K$的因数即可。
决策是,先手取$x$个,后手就取$L+1-x$个。
那个$L>=2$真的很坑。
代码:
#include<cstdio>
int n;
int main()
{
while(scanf("%d",&n)>)
{
int ans = n;
for(int i=;i*i<=n;i++)if(n%i==)
{
ans = i;
break;
}
if(ans==n&&n%==&&ans/>)ans/=;
printf("%d\n",ans-);
}
return ;
}
poj2368 Buttons的更多相关文章
- poj2368 Buttons Nim取石子游戏
链接:http://poj.org/problem?id=2368 和前面差距还是很大啊囧 代码: k,a;main(i){,i=;i<=k/&&k%i;++i);k%i||(a ...
- 博弈论BOSS
基础博弈的小结:http://blog.csdn.net/acm_cxlove/article/details/7854530 经典翻硬币游戏小结:http://blog.csdn.net/acm_c ...
- 【Mark】博弈类题目小结(HDU,POJ,ZOJ)
转载请注明出处,谢谢http://blog.csdn.net/ACM_cxlove?viewmode=contents by---cxlove 首先当然要献上一些非常好的学习资料: 基础博弈的小 ...
- [poj2368]Buttons_博弈论
Buttons poj-2368 题目大意:给定n个按钮,每次可以按动[1,t]个.求最小的t使得先手必败. 注释:$1\le n\le 10^8$. 想法:经典巴什博弈. 求n的最小非1约数-1即可 ...
- Android 添加ActionBar Buttons
一.在res/menu文件夹下创建Xml文件 跟标签为menu,设置item <?xml version="1.0" encoding="utf-8"?& ...
- Lesson 6 Percy Buttons
Text I have just moved to a house in Bridge Street. Yesterday a bagger knocked at my door. He asked ...
- BUTTONS V. 2.0.0——CSS按钮库
BUTTONS-V2-CSS库样式职责 CSS库样式职责分离优点 模块样式命名更清晰化 易于维护.扩展性强 动画效果——修改样式后有过度效果,默认样式 源码如下 <!DOCTYPE html&g ...
- CodeForces 520B Two Buttons(用BFS)
Two Buttons time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...
- Codeforces Round B. Buttons
Manao is trying to open a rather challenging lock. The lock has n buttons on it and to open it, you ...
随机推荐
- python 元类 type metaclass
python中一切皆对象,类对象创建实例对象,元类创建类对象,元类创建元类. 元类创建类对象有2中方式: 一.type方法 type(类名, 由父类名称组成的元组(针对继承的情况,可以为空),包含属性 ...
- springcloud(二) 负载均衡器 ribbon
代码地址:https://github.com/showkawa/springBoot_2017/tree/master/spb-demo ribbon是一个负载均衡客户端 类似nginx反向代理,可 ...
- deque双向队列
对于双向队列,与队列queue以及vector容器的区别就在于,名字不同,也就是它是双向的,可以从头开始操作,也可以从末尾开始操作. 双向队列的常用方法跟队列queue差不多: 头文件: #inclu ...
- android 显示目录下图片
知识点 1. 网格视图 2. 读取文件 MainAcitvity package com.test.gridview; import android.support.v7.app.AppCompatA ...
- Sublime Text3 配置C++(附oj刷题常用模板)
# 下载对应平台的sublime sublime最新版下载, 字体样式个人喜欢Consolas, 另附注册码: -– BEGIN LICENSE -– TwitterInc 200 User Lice ...
- Party Games UVA - 1610
题目 #include<iostream> #include<string> #include<algorithm> using namespace std; // ...
- rac 添加 资源
10g : 自动化.监控.os,存储,底成,网络,规范
- PowerShell和Bash的介绍
PowerShell是运行在windows平台的脚本,而Bash是运行在linux平台的脚本 现在bash能做的事情,PowerShell也能做,PowerShell的强大之处是它可以管理window ...
- [BZOJ1040][ZJOI2008]骑士 基环树DP
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1040 题目给出了$n$个点和$n$条无向边,即一棵基环树或者基环树森林. 如果题目给的关系 ...
- TCAM 与CAM
CAM是Content Addressable Memory的缩写,即"内容寻址存储器"的意思,它是在传统的存储技术的基础上实现的联想记忆存储器,关于CAM的基本操作有三种: 1) ...