Plate Game codeforces197A 思维

来源:互联网 发布:js除法保留两位小数 编辑:程序博客网 时间:2024/05/16 08:05
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 widthb and the infinite number of plates of radiusr. 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;}

0 0
原创粉丝点击