【博弈】【HDU】取石子游戏
取石子游戏
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 7192 Accepted Submission(s): 4313
参看Sample Output.
13
10000
0
Second win
First win
#include<bits/stdc++.h>
using namespace std; long long fs[]; void init() {
fs[] = ;
fs[] = ; for(int i = ; i <= ;i ++) {
fs[i] = fs[i-] + fs[i-];
}
} bool find(long long n) {
int l = ;
int r = ;
int mid = (l+r) >> ; // (l+r)/2
while(l <= r) {
if(fs[mid] == n) return true;
else if(fs[mid] < n) l = mid + ;
else r = mid - ;
mid = (l+r) >> ;
}
return false;
} int main() { init();
long long n;
while(~scanf("%lld",&n)&&n) {
if(find(n)) puts("Second win");
else puts("First win");
}
return ;
}
【博弈】【HDU】取石子游戏的更多相关文章
- HDU.2516 取石子游戏 (博弈论 斐波那契博弈)
HDU.2516 取石子游戏 (博弈论 斐波那契博弈) 题意分析 简单的斐波那契博弈 博弈论快速入门 代码总览 #include <bits/stdc++.h> #define nmax ...
- 取石子游戏 HDU 1527 博弈论 威佐夫博弈
取石子游戏 HDU 1527 博弈论 威佐夫博弈 题意 有两堆石子,数量任意,可以不同.游戏开始由两个人轮流取石子.游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子:二是可以在两 ...
- HDU 2516 取石子游戏(斐波那契博弈)
取石子游戏 Time Limit: 2000/1000 MS(Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submissi ...
- HDU 2516 取石子游戏(FIB博弈)
取石子游戏 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submi ...
- hdu 2516 取石子游戏 (博弈)
取石子游戏 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submi ...
- hdu 2516 取石子游戏 (Fibonacci博弈)
取石子游戏 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submi ...
- 取石子游戏(hdu1527 博弈)
取石子游戏 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Subm ...
- POJ.1067 取石子游戏 (博弈论 威佐夫博弈)
POJ.1067 取石子游戏 (博弈论 威佐夫博弈) 题意分析 简单的威佐夫博弈 博弈论快速入门 代码总览 #include <cstdio> #include <cmath> ...
- poj 1067 取石子游戏 (威佐夫博弈)
取石子游戏 http://poj.org/problem?id=1067 Time Limit: 1000MS Memory Limit: 10000K Description 有两堆 ...
随机推荐
- ActiveMQ学习系列(二)----生产者客户端(java)
上文主要简单地将activeMq搭建了起来,并且可以用web console去登录查看相关的后台功能. 本文将学习如何用java语言实现一个生产者客户端,主要参考了以下链接: http://activ ...
- Qt自定义控件
Qt创建自定义控件教程 一.新建Qt设计师控件 二.设置项目名称 三.选择kits 这里取消Debug选项,不需要这个选项都是编译为dll文件直接调用. 删除掉MyControl原有的.h和cpp文件 ...
- anguar使用指令写选项卡
今天,我们来学习一下angular中怎么使用指令来实现两个选项卡的问题. 首先,要先引入jQuery文件与angularjs文件. <!DOCTYPE html><html lang ...
- 1020关于MYCAT的安装和使用总结
第一部分 读写分离配置 转自:http://www.51testing.com/html/34/369434-3686088.html 使用Mycat 做简单的读写分离(一) 原本使用的是amoeba ...
- WPF中自定义GridLengthAnimation
需求 我们想在编辑一个列表中某一个条目时,将编辑的详情内容也放置当前面,比如右侧. 可以通过将一个Grid,分成两个Cloumn,动态调整两个Cloumn的Width,就可以实现这个需求. 我们知道, ...
- ES6 new syntax of let and const (one)
variable declarations : let, const,and block scope why we redefine the way about declarations? funct ...
- [LeetCode] Redundant Connection 冗余的连接
In this problem, a tree is an undirected graph that is connected and has no cycles. The given input ...
- [LeetCode] Construct the Rectangle 构建矩形
For a web developer, it is very important to know how to design a web page's size. So, given a speci ...
- 机器学习技法:12 Neural Network
Roadmap Motivation Neural Network Hypothesis Neural Network Learning Optimization and Regularization ...
- 页面中引入mui 地址选择,点击页面中其他input时页面回到顶部
问题:在页面中引入mui地址选择时,点击页面中的input页面会滚到顶部(谷歌浏览器中出现的bug),在手机上点击input会出现跳动.开始的时候是想修改mui.min.js里的滚动事件,但是后来找到 ...