URAL 1639 Chocolate 2 (博弈论)
来源:互联网 发布:ted软件下载 编辑:程序博客网 时间:2024/06/05 07:28
1639. Chocolate 2
Time limit: 1.0 second
Memory limit: 64 MB
Memory limit: 64 MB
Little Boy is mad at Karlsson, who ate all the sweets in the flat and even went to the neighbours to eat their sweets too. Now Little Boy's parents brought home a chocolate bar, and, sure enough, Karlsson is here already and wants to eat it. However, this time Little Boy has firmly decided that not a single piece of chocolate will go to this glutton. Little Boy wants to use Karlsson's addiction to the games of chance and suggests playing the following game. A chocolate bar can be considered as a rectangle of square “units” arranged in m rows and n columns and separated by “lines”. Two players take alternate turns. At his turn, a player must take one piece of chocolate and split it into two along one of the lines. If a player can't make a legal move (which happens when all pieces of chocolate consist of a single unit square), he loses, and the winner takes all the chocolate.
But Karlsson is smart enough! He immediately understood who should make the first turn in order for Karlsson to win, assuming that players take optimal turns. Can you guess that?
Input
The only line of the input contains space-separated integers m and n (1 ≤ m, n ≤ 50) .
Output
If Karlsson should start the game in order to win, output “[:=[first]”; otherwise, output “[second]=:]”.
Samples
2 4
[:=[first]
1 3
[second]=:]
题意:有划了n*m条线的巧克力,两人轮流沿线对折,第一个不能对折的那个人为输。
解析:简单博弈论。
AC代码:
#include <cstdio>int main(){ int n, m; while(scanf("%d%d", &n, &m)==2){ if(n * m & 1) puts("[second]=:]"); else puts("[:=[first]"); } return 0;}
0 0
- URAL 1639 Chocolate 2 (博弈论)
- URAL 1639 Chocolate 2 简单博弈
- URAL 1639. Chocolate 2
- URAL 1924 Four Imps (博弈论 + 规律)
- Chocolate 2
- POJ 2368|URAL 1023|Buttons|博弈论
- (UVA)Big Chocolate
- chocolate
- chocolate
- Ural 1087|The Time to Take Stones|博弈论|动态规划
- 博弈论(2):智猪博弈
- 博弈论的局限性(博弈论的诡计)
- 博弈论(1):囚徒困境中的博弈论
- 10970 - Big Chocolate(水题)
- HDU4301 Divide Chocolate(DP)
- AtCoder:Chocolate Bar(数学)
- 博弈论学习笔记2
- 博弈论——2
- 批量插入sql案例
- adb设置
- 备孕、怀孕、产子、月子知识大全
- jquery 封装jQuery.validate的插件
- 标志接口,空接口,
- URAL 1639 Chocolate 2 (博弈论)
- start_addr & NAND_BLOCK_MASK || size & NAND_BLOCK_MASK
- Weka进阶——基于KDD99数据集的入侵检测分析
- UVa 260 - Il Gioco dell'X
- WPS for Linux提示“系统缺失字体symbol、wingdings、wingdings 2、wingdings 3、webding”的解决方法
- Git Step by Step – (1) Git 简介
- 25、MySQL-连接查询
- PostgreSql中COPY的用法
- FlappyBird开发总结(四)—— GameManager.cs脚本,游戏控制