Plate Game codeforces197A 思维

本文介绍了一个简单的二人桌面游戏策略分析。游戏的目标是在一张a*b尺寸的矩形桌上放置半径为r的圆盘,两名玩家轮流放置,直至无法放置为止。文章通过巧妙的对称性分析确定了首位玩家的胜负条件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

A. Plate Game
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

You've got a rectangular table with length a and width b and the infinite number of plates of radius r. Two players play the following game: they take turns to put the plates on the table so that the plates don't lie on each other (but they can touch each other), and so that any point on any plate is located within the table's border. During the game one cannot move the plates that already lie on the table. The player who cannot make another move loses. Determine which player wins, the one who moves first or the one who moves second, provided that both players play optimally well.

Input

A single line contains three space-separated integers a, b, r (1 ≤ a, b, r ≤ 100) — the table sides and the plates' radius, correspondingly.

Output

If wins the player who moves first, print "First" (without the quotes). Otherwise print "Second" (without the quotes).

Examples
Input
5 5 2
Output
First
Input
6 7 4
Output
Second
Note

In the first sample the table has place for only one plate. The first player puts a plate on the table, the second player can't do that and loses.

In the second sample the table is so small that it doesn't have enough place even for one plate. So the first player loses without making a single move.

题面 有一个a*b的桌子 有两个人 A,B。每次每人把一个半径为r的圆盘放到桌子上,直到放不下 就算另一个人赢。

提示:对称 其实没有那么复杂。


思路:一开始想应该有非常快就能解决的方法 , 但是还是想了好久,乱七八糟的 很复杂。

其实我们只需要考察这张桌子能不能放下一个盘子 。我们将第一个盘子放在桌子的中央。

反证一下,如果说是能放下第一个盘子而赢得人是第二个的话 那么,桌子上一定有且只有偶数个盘子。

实际上对于任意一个非中央的的盘子 我们总能找到一个关于中央盘子对称的位置。

也即除了中央盘子外 一定桌子上有偶数个盘子。 这与总共有偶数个盘子矛盾。

故若放下一个盘子 那么一定可以并且只可以放下奇数个盘子,也就意味着第一个人赢。

思路通了 代码就很简单了,还是贴一下把,虽然就几行hh。

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    a=min(a,b);
    c=c*2;
    if(a>=c) cout<<"First"<<endl;
    else cout<<"Second"<<endl;
    return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值