A8112 | Beaver Game
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Two beavers, Timur and Marsel, play the following game.
There are $n$ logs, each of exactly $m$ meters in length. The beavers move in turns. For each move a beaver chooses a log and gnaws it into some number (more than one) of equal parts, the length of each one is expressed by an integer and is no less than $k$ meters. Each resulting part is also a log which can be gnawed in future by any beaver. The beaver that can't make a move loses. Thus, the other beaver wins.
Timur makes the first move. The players play in the optimal way. Determine the winner.
There are $n$ logs, each of exactly $m$ meters in length. The beavers move in turns. For each move a beaver chooses a log and gnaws it into some number (more than one) of equal parts, the length of each one is expressed by an integer and is no less than $k$ meters. Each resulting part is also a log which can be gnawed in future by any beaver. The beaver that can't make a move loses. Thus, the other beaver wins.
Timur makes the first move. The players play in the optimal way. Determine the winner.
输入格式
The first line contains three integers $n$ , $m$ , $k$ ( $1<=n,m,k<=10^{9}$ ).
输出格式
Print "Timur", if Timur wins, or "Marsel", if Marsel wins. You should print everything without the quotes.
输入输出样例
输入 #1
1 15 4
输出 #1
Timur
输入 #2
4 9 5
输出 #2
Marsel
In the first sample the beavers only have one log, of $15$ meters in length. Timur moves first. The only move he can do is to split the log into $3$ parts each $5$ meters in length. Then Marsel moves but he can't split any of the resulting logs, as $k=4$ . Thus, the winner is Timur.
In the second example the beavers have $4$ logs $9$ meters in length. Timur can't split any of them, so that the resulting parts possessed the length of not less than $5$ meters, that's why he loses instantly.
In the second example the beavers have $4$ logs $9$ meters in length. Timur can't split any of them, so that the resulting parts possessed the length of not less than $5$ meters, that's why he loses instantly.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted