CF513A.Game

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Two players play a simple game. Each player is provided with a box with balls. First player's box contains exactly _n_1 balls and second player's box contains exactly _n_2 balls. In one move first player can take from 1 to _k_1 balls from his box and throw them away. Similarly, the second player can take from 1 to _k_2 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.

两名玩家进行一个简单的游戏。每位玩家都有一个装有球的盒子。第一位玩家的盒子里恰好有 n1n_1 个球,第二位玩家的盒子里恰好有 n2n_2 个球。在一次操作中,第一位玩家可以从自己的盒子中取出 11 至 k1k_1 个球并丢弃;类似地,第二位玩家在自己的回合中可以从自己的盒子中取出 11 至 k2k_2 个球。双方轮流行动,且由第一位玩家先手。无法进行操作的一方判负。你的任务是:在双方均采取最优策略的前提下,判断哪位玩家获胜。

输入格式

The first line contains four integers _n_1, _n_2, _k_1, _k_2. 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.

第一行包含四个整数 n1n_1、n2n_2、k1k_1、k2k_2。输入中的所有数字均在 11 到 5050 之间。

本题没有子问题。正确提交可获得 33 分。

输出格式

Output "First" if the first player wins and "Second" otherwise.

如果先手玩家获胜,输出“First”;否则输出“Second”。

输入输出样例

  • 输入#1

    2 2 1 2

    输出#1

    Second
  • 输入#2

    2 1 1 1

    输出#2

    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.

考虑第一个样例测试。每位玩家都有一个装有 2 个球的盒子。第一位玩家每次从自己的盒子中抽取 1 个球;第二位玩家每次可以从自己的盒子中取走 1 个或 2 个球。无论第一位玩家如何行动,只要第二位玩家采取最优策略,就总能获胜。

输入解题思路,AI测评打分。不知道怎么写?

首页