Problem 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 = 9intersection 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.

Examples

Input

2 2
2 3
3 3

Output

Malvika
Malvika
Akshat

Note

Explanation of the first sample:

The grid has four intersection points, numbered from 1 to 4.

If Akshat chooses intersection point 1, then he will remove two sticks (1 - 2 and 1 - 3). The resulting grid will look like this.

Now there is only one remaining intersection point (i.e. 4). Malvika must choose it and remove both remaining sticks. After her move the grid will be empty.

In the empty grid, Akshat cannot make any move, hence he will lose.

Since all 4 intersection points of the grid are equivalent, Akshat will lose no matter which one he picks.

解题思路:这算是一道简单的博弈题吧。题目的意思就是只要有交叉点,轮到的人就可以移走两根棍子(一横一竖),如果轮到的人当前没有交叉点,那么这个人就输。我们找找规律:

n(m)  m(n)           赢家

1   1  2  3  4...Akshat(先手)

2   2  3  4  5...Malvika(后手)

3   3  4  5  6...Akshat

4   4  5  6  7...Malvika

...

按照上面的方式继续推导下去,我们可以发现:如果输入的n、m中最小值是奇数,那么先手Akshat必赢,否则后手Malvika必赢。

AC代码:

 #include <bits/stdc++.h>
using namespace std;
int main(){
int n,m,minval;
cin>>n>>m;
minval=min(n,m);
if(minval%)cout<<"Akshat"<<endl;
else cout<<"Malvika"<<endl;
return ;
}

C - Game With Sticks的更多相关文章

  1. HDOJ 1051. Wooden Sticks 贪心 结构体排序

    Wooden Sticks Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) To ...

  2. POJ 2653 Pick-up sticks (线段相交)

    题意:给你n条线段依次放到二维平面上,问最后有哪些没与前面的线段相交,即它是顶上的线段 题解:数据弱,正向纯模拟可过 但是有一个陷阱:如果我们从后面向前枚举,找与前面哪些相交,再删除前面那些相交的线段 ...

  3. hduoj 1455 && uva 243 E - Sticks

    http://acm.hdu.edu.cn/showproblem.php?pid=1455 http://uva.onlinejudge.org/index.php?option=com_onlin ...

  4. POJ 2653 Pick-up sticks【线段相交】

    题意:n根木棍随意摆放在一个平面上,问放在最上面的木棍是哪些. 思路:线段相交,因为题目说最多有1000根在最上面.所以从后往前处理,直到木棍没了或者最上面的木棍的总数大于1000. #include ...

  5. POJ1065Wooden Sticks[DP LIS]

    Wooden Sticks Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 21902   Accepted: 9353 De ...

  6. 【POJ 2653】Pick-up sticks 判断线段相交

    一定要注意位运算的优先级!!!我被这个卡了好久 判断线段相交模板题. 叉积,点积,规范相交,非规范相交的简单模板 用了“链表”优化之后还是$O(n^2)$的暴力,可是为什么能过$10^5$的数据? # ...

  7. CF451A Game With Sticks 水题

    Codeforces Round #258 (Div. 2) Game With Sticks A. Game With Sticks time limit per test 1 second mem ...

  8. POJ 2452 Sticks Problem

    RMQ+二分....枚举 i  ,找比 i 小的第一个元素,再找之间的第一个最大元素.....                   Sticks Problem Time Limit: 6000MS ...

  9. The 2015 China Collegiate Programming Contest D.Pick The Sticks hdu 5543

    Pick The Sticks Time Limit: 15000/10000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others ...

  10. Pick-up sticks[HDU1147]

    Pick-up sticksTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total ...

随机推荐

  1. Hadoop多节点Cluster

    Hadoop多节点集群规划 服务起名称 内网IP HDFS YARN master 192.168.1.155 NameNode ResourceManager slave1 192.168.1.11 ...

  2. js-构造数组

    js中,字符串的特性跟数组非常类似.数组是一种很重要的数据结构.在java中,数组声明的时候就要为其指定类型,数组中只能放同一种类型的数据.Js中的数组可以放不同的类型,但是是有序的,类似于java中 ...

  3. golang入门-defer

    package main import "fmt" func main() { i := 5 tmap := make(map[string]int, 5) tmap[" ...

  4. TensorFlow的序列模型代码解释(RNN、LSTM)---笔记(16)

    1.学习单步的RNN:RNNCell.BasicRNNCell.BasicLSTMCell.LSTMCell.GRUCell (1)RNNCell 如果要学习TensorFlow中的RNN,第一站应该 ...

  5. 通过JDBC取Oracle数据库的时间字段时,时间丢失,只剩日期

    通过JDBC连接Oracle数据库,在查询的时候发现时间字段取出来值后只剩下了日期,时间消失了.查资料发现跟Oracle jdbc驱动版本有关,这里先贴出解决方案: 修改数据库的连接方式: try { ...

  6. 解决windows文件在linux系统中显示乱码的问题

    问题: 在Windows下用matlab写的代码(.m)到Linux(centos)下,注释的中文全是乱码. 原因: Windows下默认使用的是GB2312编码,Linux默认使用的是UTF-8. ...

  7. 【[Offer收割]编程练习赛10 B】出勤记录II

    [题目链接]:http://hihocoder.com/problemset/problem/1482 [题意] [题解] 递推题. 每次增加3个字符中的一个;然后根据下面这个数组递推; 递推方式看程 ...

  8. 【hihocoder 1476】矩形计数

    [题目链接]:http://hihocoder.com/problemset/problem/1476 [题意] [题解] 首先不考虑黑格子,计算出一共有多少个矩形: 枚举矩形的大小r×c,这样大小的 ...

  9. Spring Cloud-hystrix(六)

    作用 防止 多个服务相互交互时某个服务运行缓慢导致调用方线程挂起,高并发情况下 导致挂起线太多 引起调用方的服务不可用 能够在服务发生故障或者通过断路器监控向调用方返回一个错误 而不是长时间的等待 S ...

  10. asp.net--WebService知识点

    开头是这样的 [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = Wsi ...