ZOJ 3882Help Bob
来源:互联网 发布:有抢房秒杀的软件吗 编辑:程序博客网 时间:2024/05/17 05:43
There is a game very popular in ZJU at present, Bob didn't meant to participate in it. But he decided to join it after discovering a lot of pretty girls playing it.
There are n stones on the ground and they are marked as 1 to n respectively. There will be 2 players in each competition. And the game rules are simple, A and B take turns to move. Each round, one of them can only take 1 number away, and then pick out all the divisors of the choosed number. When anyone who can not take away 1 number any longer, he will fail the whole game.
Input
There are multiple cases. Each case include an integer number n (0 ≤ n ≤ 100).
Output
For each case, A win, output "win". If not, output"fail".
Sample Input1
34
Sample Output1
winwin
假设有先手必败,那么此时取1,得到的剩下的情况仍旧会是先手必败,矛盾
所以先手必胜,注意特判0
#include<cstdio>#include<cmath>#include<queue>#include<vector>#include<stack>#include<map>#include<string>#include<cstring>#include<algorithm>#include<iostream>using namespace std;typedef long long ll;const ll maxn = 100005;int T, n, m, f[maxn], dp[maxn * 10];int main(){while (scanf("%d", &n) == 1){if (n == 0) printf("fail\n");else printf("win\n");}return 0;}
- ZOJ 3882Help Bob
- zoj 3882 Help Bob
- ZOJ-3882 Help Bob
- ZOJ Help Bob 3882【博弈】
- (zoj 3882 Help Bob)<>
- zoj 3882 Help Bob(博弈)
- zoj 3882 Help Bob(zoj 2015年7月月赛)
- ZOJ 月赛 Help Bob
- Help Bob (141 - ZOJ Monthly, July 2015 )
- (博弈)Help Bob (141 - ZOJ Monthly, July 2015 )
- ZOJ3882.Help Bob
- zoj3882 Help Bob 博弈
- zoj 2504 help john
- ZOJ 2504 Help John!
- Help Me Escape ZOJ
- ZOJ 2504 Help John! (dijkstra)
- zoj 2504 Help John!(Dijkstra~~)
- ZOJ-3640-Help Me Escape
- ncurses简单的一个多窗口程序
- Fragment的生命周期(4)
- Spring JSR-250注解
- Linux下Mysql的rpm的安装
- [about phd]读博=
- ZOJ 3882Help Bob
- [黑马程序员](第50天)一些平时刷的题(3)
- ENV and IRB
- Spring Bean 的作用域、初始化和销毁
- 初识HTML+ CSS
- HDUOJ 1022 (栈的基本应用)火车进站问题I
- 如何编写Xcode 插件
- 初识html
- poj_1877