Codeforce 513A - Game
Two players play a simple game. Each player is provided with a box with balls. First player's box contains exactly n1 balls and second player's box contains exactly n2 balls. In one move first player can take from 1 to k1 balls from his box and throw them away. Similarly, the second player can take from 1 to k2 balls from his box in his move. Players alternate turns and the first player starts the game. The one who can't make a move loses. Your task is to determine who wins if both players play optimally.
The first line contains four integers n1, n2, k1, k2. All numbers in the input are from 1 to 50.
This problem doesn't have subproblems. You will get 3 points for the correct submission.
Output "First" if the first player wins and "Second" otherwise.
2 2 1 2
Second
2 1 1 1
First
Consider the first sample test. Each player has a box with 2 balls. The first player draws a single ball from his box in one move and the second player can either take 1 or 2 balls from his box in one move. No matter how the first player acts, the second player can always win if he plays wisely.
题解:每次都拿一个
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
const int N=;
const int mod=1e9+;
int main()
{
// std::ios::sync_with_stdio(false);
int n1,n2,k1,k2;
cin>>n1>>n2>>k1>>k2;
if(n1<=n2) cout<<"Second"<<endl;
else if(n1>n2) cout<<"First"<<endl;
return ;
}
Codeforce 513A - Game的更多相关文章
- Codeforce - Street Lamps
Bahosain is walking in a street of N blocks. Each block is either empty or has one lamp. If there is ...
- Codeforce Round #216 Div2
e,还是写一下这次的codeforce吧...庆祝这个月的开始,看自己有能,b到什么样! cf的第二题,脑抽的交了错两次后过了pretest然后system的挂了..脑子里还有自己要挂的感觉,果然回头 ...
- Codeforce 水题报告(2)
又水了一发Codeforce ,这次继续发发题解顺便给自己PKUSC攒攒人品吧 CodeForces 438C:The Child and Polygon: 描述:给出一个多边形,求三角剖分的方案数( ...
- codeforce 375_2_b_c
codeforce 375_2 标签: 水题 好久没有打代码,竟然一场比赛两次卡在边界条件上....跪 b.题意很简单...纯模拟就可以了,开始忘记了当字符串结束的时候也要更新两个值,所以就错了 #i ...
- codeforce 367dev2_c dp
codeforce 367dev2_c dp 标签: dp 题意: 你可以通过反转任意字符串,使得所给的所有字符串排列顺序为字典序,每次反转都有一定的代价,问你最小的代价 题解:水水的dp...仔细想 ...
- 三维dp&codeforce 369_2_C
三维dp&codeforce 369_2_C 标签: dp codeforce 369_2_C 题意: 一排树,初始的时候有的有颜色,有的没有颜色,现在给没有颜色的树染色,给出n课树,用m种燃 ...
- 强连通分量&hdu_1269&Codeforce 369D
强连通分量 标签: 图论 算法介绍 还记得割点割边算法吗.回顾一下,tarjan算法,dfs过程中记录当前点的时间戳,并通过它的子节点的low值更新它的low,low值是这个点不通过它的父亲节点最远可 ...
- 【树状数组】区间出现偶数次数的异或和(区间不同数的异或和)@ codeforce 703 D
[树状数组]区间出现偶数次数的异或和(区间不同数的异或和)@ codeforce 703 D PROBLEM 题目描述 初始给定n个卡片拍成一排,其中第i个卡片上的数为x[i]. 有q个询问,每次询问 ...
- 解题报告:codeforce 7C Line
codeforce 7C C. Line time limit per test1 second memory limit per test256 megabytes A line on the pl ...
随机推荐
- SSAS下玩转PowerShell
操作SSAS数据库的方法有非常多,是否有一种能够方法能够通过脚本自己主动去做这些事呢,比方处理分区,创建备份以及监视SSAS的执行状况. 原文地址: http://www.mssqltips ...
- react-native-image-picker iOS设置
效果图,因为我用的是模拟器,所以拍照功能没有效果,不过可从相册选择,下面是具体的效果图 把react-native-image-picker添加到项目 yarn add react-native-im ...
- 爬虫请求库——requests
请求库,即可以模仿浏览器对网站发起请求的模块(库). requests模块 使用requests可以模拟浏览器的请求,requests模块的本质是封装了urllib3模块的功能,比起之前用到的urll ...
- 云锁-安全,易用,灵活的许可-Virbox许可管理平台
云许可,助力开发者保护软件财富 Virbox 云锁提供高强度加密及软件许可管理功能 安全,易用,灵活 防破解 云许可安全性体验与硬件锁一致,避免盗版导致损失 加密保护技术:反黑引擎/碎片代码执行/虚拟 ...
- 2017-2018-2 20165236 实验三《Java面向对象程序设计》实验报告
2017-2018-2 20165236 实验三<Java面向对象程序设计>实验报告 一.实验报告封面 课程:Java程序设计 班级:1652 姓名:郭金涛 ...
- oracle sql 游标的简单用法(tip:sql中两个单引号表示一个单引号)
--游标遍历某个字段 (打印出来) declare res_sql varchar2(2000); cursor cur is select f_dcnam ...
- Scala枚举--Enumeration
object Color extends Enumeration(2){ val Red,Green,Blue = Value val Yellow = Value("YELLOW" ...
- python的运行机制
不需要生成二进制代码,python解释器把源码->字节码,然后在执行这些字节码. 解释器的具体工作: 1.完成模块(module)的加载和链接 2.将源代码编译成pyCodeObject(字节码 ...
- field-symbols: <ATTR> type ANY.
field-symbols: type ANY. * importing iv_root_list type refer to if_genil_cont_root_objectlist DATA l ...
- spring——事务管理
1.spring支持编程式事务管理和声明式事务管理. 编程式事务管理:编程式事务管理使用TransactionTemplate或者直接使用最底层的PlatformTransactionManager. ...