jiejiejiang2004

题解:CodeForces 197A Plate Game [博弈论]

CodeForces 197A

A.Plate Game

time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard 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

我的题解

如果不能放,就后手赢
如果能放,就先手赢
因为先手总能找到机会卡后手位置(非正解)
(来自学长的提醒 -> 正解)
如果能放,则先手放中间,然后跟着后手对称放,先手必赢
如果不能放,则先手输
(说的太对了,我的疏忽)

我的代码

#include <iostream>

#define int long long

int t;

void solve()
{
    int a,b,r,num = 0,num1 = 0;
    std::cin >> a >> b >> r;
    int d = r * 2;
    if(a < d || b < d) std::cout << "Second\n";
    else std::cout << "First\n";
}

signed main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);

	t = 1;
	//std::cin >> t;
	while(t--)
	{
		solve();
	}
    return 0;
}


有什么出现纰漏的地方还请大家在评论区指出!谢谢!

posted on 2024-07-14 13:36  Jiejiejiang  阅读(3)  评论(0编辑  收藏  举报

导航