Codeforces Round #258 (Div. 2) A. Game With Sticks 水题
A. Game With Sticks
题目连接:
http://codeforces.com/contest/451/problem/A
Description
After winning gold and silver in IOI 2014, Akshat and Malvika want to have some fun. Now they are playing a game on a grid made of n horizontal and m vertical sticks.
An intersection point is any point on the grid which is formed by the intersection of one horizontal stick and one vertical stick.
In the grid shown below, n = 3 and m = 3. There are n + m = 6 sticks in total (horizontal sticks are shown in red and vertical sticks are shown in green). There are n·m = 9 intersection points, numbered from 1 to 9.
The rules of the game are very simple. The players move in turns. Akshat won gold, so he makes the first move. During his/her move, a player must choose any remaining intersection point and remove from the grid all sticks which pass through this point. A player will lose the game if he/she cannot make a move (i.e. there are no intersection points remaining on the grid at his/her move).
Assume that both players play optimally. Who will win the game?
Input
The first line of input contains two space-separated integers, n and m (1 ≤ n, m ≤ 100).
Output
Print a single line containing "Akshat" or "Malvika" (without the quotes), depending on the winner of the game.
Sample Input
2 2
Sample Output
Malvika1
Hint
题意
有n根横着的筷子,m根竖着的筷子,会相交出nm个交点,然后现在两个人依次玩这个游戏,每次这个人选择一个点,然后就会把穿过这个点的筷子都拿掉。
哪个人不能操作的时候,就判断这个人输掉了。
问最后谁会胜利。
题解:
取min之后,判断奇偶性就好了~
代码
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
scanf("%d%d",&n,&m);
n=min(n,m);
if(n%2)printf("Akshat\n");
else printf("Malvika\n");
}
Codeforces Round #258 (Div. 2) A. Game With Sticks 水题的更多相关文章
- Codeforces Round #258 (Div. 2) D. Count Good Substrings 水题
D. Count Good Substrings 题目连接: http://codeforces.com/contest/451/problem/D Description We call a str ...
- Codeforces Round #297 (Div. 2)A. Vitaliy and Pie 水题
Codeforces Round #297 (Div. 2)A. Vitaliy and Pie Time Limit: 2 Sec Memory Limit: 256 MBSubmit: xxx ...
- Codeforces Round #290 (Div. 2) A. Fox And Snake 水题
A. Fox And Snake 题目连接: http://codeforces.com/contest/510/problem/A Description Fox Ciel starts to le ...
- Codeforces Round #322 (Div. 2) A. Vasya the Hipster 水题
A. Vasya the Hipster Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/p ...
- Codeforces Round #373 (Div. 2) B. Anatoly and Cockroaches 水题
B. Anatoly and Cockroaches 题目连接: http://codeforces.com/contest/719/problem/B Description Anatoly liv ...
- Codeforces Round #368 (Div. 2) A. Brain's Photos 水题
A. Brain's Photos 题目连接: http://www.codeforces.com/contest/707/problem/A Description Small, but very ...
- Codeforces Round #359 (Div. 2) A. Free Ice Cream 水题
A. Free Ice Cream 题目连接: http://www.codeforces.com/contest/686/problem/A Description After their adve ...
- Codeforces Round #355 (Div. 2) A. Vanya and Fence 水题
A. Vanya and Fence 题目连接: http://www.codeforces.com/contest/677/problem/A Description Vanya and his f ...
- Codeforces Round #258 (Div. 2/A)/Codeforces451A_Game With Sticks
解题报告 http://blog.csdn.net/juncoder/article/details/38102263 n和m跟木棍相交,问一人取一交点(必须是交点.且取完后去掉交点的两根木棍),最后 ...
随机推荐
- html template--(来自网易)
html template 概述 包含完整头部信息和主体结构的HTML基础模板. 代码展示 <!DOCTYPE html> <html> <head> < ...
- BAT及各大互联网公司2014前端笔试面试题--Html,Css篇(昨天有个群友表示写的简单了点,然后我无情的把他的抄了一遍)
某个群友 http://www.cnblogs.com/coco1s/ 很多面试题是我自己面试BAT亲身经历碰到的.整理分享出来希望更多的前端er共同进步吧,不仅适用于求职者,对于巩固复习前端基础 ...
- FFT(Rock Paper Scissors Gym - 101667H)
题目链接:https://vjudge.net/problem/Gym-101667H 题目大意:首先给你两个字符串,R代表石头,P代表布,S代表剪刀,第一个字符串代表第一个人每一次出的类型,第二个字 ...
- j2ee组件简介
- mysql学习------权限机制
MySQL服务器通过MySQL权限表来控制用户对数据库的访问,MySQL权限表存放在mysql数据库里,由mysql_install_db脚本初始化.这些MySQL权限表分别user,db,table ...
- 图解USB协议之一 枚举过程【转】
转自:http://blog.csdn.net/myarrow/article/details/8270060 0. 枚举流程 • 连接了设备的 HUB 在 HOST 查询其状态改变端点 时返回对应的 ...
- 让linux中 history显示每条命令的操作时间及操作用户【转】
一.history 中显示日期时间用户名的办法 history 命令,用来显示命令行上的操作记录 不过默认是仅显示操作命令行本身,而没有记录操作时间等细节 例如 这样,我们查找记录时很麻烦,想回顾下某 ...
- CasperJS API中文博客链接
http://www.cnblogs.com/reach296/tag/Casperjs/
- 几种list排序方法
package com.lgx.jdk8.part02; import java.util.*; import java.util.stream.Collectors; /** * Comparato ...
- 浅谈TCP拥塞控制算法
TCP通过维护一个拥塞窗口来进行拥塞控制,拥塞控制的原则是,只要网络中没有出现拥塞,拥塞窗口的值就可以再增大一些,以便把更多的数据包发送出去,但只要网络出现拥塞,拥塞窗口的值就应该减小一些,以减少注入 ...