Whu 1604——Play Apple——————【博弈】
Total Submit: 442 Accepted: 177 Special Judge: No
There are N apples. Two people take turns to either:
1. Divide the apple into two piles with different numbers.
2. The other people selects a pile of apples as the beginning of the next turn.
If someone can not meet the requirements, he is lost. Will the first one win the game if both use the best strategy?
The first line of each case contains a integer N. ( 1 <= N <= 1000000000 )
3
4
Yes
No
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
typedef long long LL;
int main(){
int n;
while(scanf("%d",&n)!=EOF){
if(n == 1 || n == 2){
puts("No");
}else if(n == 3){
puts("Yes");
}else{
if((n-3) % 3 == 1){
puts("No");
}else{
puts("Yes");
}
}
}
return 0;
}
Whu 1604——Play Apple——————【博弈】的更多相关文章
- Play Apple(博弈)
Problem 1604 - Play Apple Time Limit: 1000MS Memory Limit: 65536KB Total Submit: 434 Accepted: ...
- codeforces 812E Sagheer and Apple Tree(思维、nim博弈)
codeforces 812E Sagheer and Apple Tree 题意 一棵带点权有根树,保证所有叶子节点到根的距离同奇偶. 每次可以选择一个点,把它的点权删除x,它的某个儿子的点权增加x ...
- codeforces 812 E. Sagheer and Apple Tree(树+尼姆博弈)
题目链接:http://codeforces.com/contest/812/problem/E 题意:有一颗苹果树,这个苹果树所有叶子节点的深度要不全是奇数,要不全是偶数,并且包括根在内的所有节点上 ...
- Codeforces 812E Sagheer and Apple Tree ——(阶梯博弈)
之前在bc上做过一道类似的阶梯博弈的题目,那题是移动到根,这题是移动到叶子.换汤不换药,只要和终态不同奇偶的那些位置做nim即可.因此这题给出了一个条件:所有叶子深度的奇偶性相同.同时需要注意的是,上 ...
- Codeforces Round #417 (Div. 2)A B C E 模拟 枚举 二分 阶梯博弈
A. Sagheer and Crossroads time limit per test 1 second memory limit per test 256 megabytes input sta ...
- CodeForces 812E Sagheer and Apple Tree 树上nim
Sagheer and Apple Tree 题解: 先分析一下, 如果只看叶子层的话. 那么就相当于 经典的石子问题 nim 博弈了. 那我们看非叶子层. 看叶子层的父亲层. 我们可以发现, 如果从 ...
- dp --- acdream原创群赛(16) --- B - Apple
<传送门> B - Apple Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Other ...
- iOS: 在iPhone和Apple Watch之间共享数据: App Groups
我们可以在iPhone和Apple Watch间通过app groups来共享数据.方法如下: 首先要在dev center添加一个新的 app group: 接下来创建一个新的single view ...
- hdu----(1849)Rabbit and Grass(简单的尼姆博弈)
Rabbit and Grass Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
随机推荐
- 三、Node.js-HelloWorld案例
之前我们编写的JavaScript代码都是在浏览器中运行的,因此,我们可以直接在浏览器中敲代码,然后直接运行. 在Node,我们编写的JavaScript代码将不能在浏览器环境中执行了,而是在Node ...
- struts2官方 中文教程 系列一:创建一个struts2 web Application
先贴了本帖地址,以免被爬 http://www.cnblogs.com/linghaoxinpian/p/6898779.html 本教程将会通过安装struts2框架来创建一个简单的应用程序.虽然 ...
- Markdown使用样例
# 欢迎使用 Cmd - 在线 Markdown 编辑阅读器 ------ 我们理解您需要更便捷更高效的工具记录思想,整理笔记.知识,并将其中承载的价值传播给他人,**Cmd Markdown** 是 ...
- Docker - CentOS 安装 Docker 和 Docker-Compose
目录 介绍 Docker Docker-Conpose 安装 Docker CE 系统要求 使用 YUM 安装 配置加速器 安装 Docker-Compose 介绍 Docker Docker 是一个 ...
- ScrollView-电影列表
ScrollView 的使用import React, { Component } from 'react';import { Platform, StyleSheet, Text, View, Sc ...
- 网络控制芯片AX88796B系列使用简介
目录 1. 特性 2. 结构框图 3. 接收 3.1 缓存空间 3.2 Receiver Buffer Ring 3.3 接收机制 4. 发送 5. 编程过程简要说明 5.1 初始化配置 5.2 接收 ...
- centos用ifconfig不显示ip地址的解决方法
解决办法: 第一步: 输入ip addr 发现ens33中并不包含IP内容 第二步: 输入cd /etc/sysconfig/network-scripts/ 回车 然后输入 ls 回车 第三步:选 ...
- tornado 07 数据库—ORM—SQLAlchemy—查询
tornado 07 数据库—ORM—SQLAlchemy—查询 引言 #上节课使用query从数据库查询到了结果,但是query返回的对象是直接可用的吗 #在query.py内输入一下内容 from ...
- UVA - 11825 状压DP
该题目是EMAXX推荐的练习题,刘汝佳的书也有解说 如果S0属于全集,那S0就可以作为一个分组,那么S分组数可以是best{当前S中S0的补集+1} 对于集合类的题目我觉得有点抽象,希望多做多理解把 ...
- Aop之使用Castle动态代理实现对方法的拦截
using System; using System.Linq; using Castle.DynamicProxy; namespace AopTest { class AopTest { stat ...