Plate Game codeforces197A 思维
来源:互联网 发布:js除法保留两位小数 编辑:程序博客网 时间:2024/05/16 08:05
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.
A single line contains three space-separated integers a,b, r(1 ≤ a, b, r ≤ 100) — the table sides and the plates' radius, correspondingly.
If wins the player who moves first, print "First" (without the quotes). Otherwise print "Second" (without the quotes).
5 5 2
First
6 7 4
Second
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;}
- Plate Game codeforces197A 思维
- Plate Game
- Plate Game
- Codeforces Round #124 (Div. 2)A. Plate Game(思维)
- 【CodeForces】Plate Game(博弈)
- CodeForces 197A Plate Game
- Codeforces 197A Plate game
- CodeForces 197A-Plate Game
- Codeforces Round #124 (Div. 2) / A. Plate Game
- 【CF】Codeforces Round #124 (Div. 2) 197A Plate Game
- Codeforces Round #124 (Div. 2) A. Plate Game(博弈)
- 多线程 plate
- codeforcces Karen and Game 思维
- UESTC 1050 Different game【思维】
- The Meaningless Game 【codeforces】【思维】
- codeforces 298 C Parity Game 思维问题
- hdoj 4944 FSF’s game 【数学思维】
- **LeetCode 45. Jump Game II 思维题
- 第二届2011年国信蓝点杯软件设计大赛预赛的试题7
- 在 CentOS7 上安装 MySQL5.7
- java之直接插入排序
- java类的构造方法
- 第二届2011年国信蓝点杯软件设计大赛预赛的试题8
- Plate Game codeforces197A 思维
- Http协议
- 外网访问的一个方法
- 快速排序
- CentOS-7下安装MySQL5.6.22
- Android中两种selector选择器(背景,文字颜色)
- 第二届2011年国信蓝点杯软件设计大赛预赛的试题9
- 并查集代码
- 第二届2011年国信蓝点杯软件设计大赛预赛的试题10