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. 读书笔记之:C++ Primer (第4版)及习题(ch01-ch11) [++++]

    读书笔记之:C++ Primer (第4版)及习题(ch01-ch11) [++++] 第2章 数据和基本类型 1. 整型 2. 习题:左值和右值 3. C++关键字/保留字和操作符替代值 4. 声明 ...

  2. 给数组增加remove函数

    //给数组增加indexOf函数Array.prototype.indexOf = function(val) { for (var i = 0; i < this.length; i++) { ...

  3. 如果说需要注册数据中心,这样才能使用demo部署数据中心license证需要申请,使用云之间-工作流程......

    如果说需要注册数据中心,这样才能使用demo部署数据中心license证需要申请,使用云之间-工作流程......

  4. eas之KDPrinter控件

    初始化打印控件KDPrinter ctrlPrinter = new KDPrinter(); 增加列 // 指定插入位置table.addColumn(index);// 插入到最后table.ad ...

  5. HAOI2010软件安装(树形背包)

    HAOI2010软件安装(树形背包) 题意 有n个物品,每个物品最多会依赖一个物品,但一个物品可以依赖于一个不独立(依赖于其它物品)的物品,且可能有多个物品依赖一个物品,并且依赖关系可能形成一个环.现 ...

  6. 洛谷11月月赛(284pts rank85)

    https://www.luogu.org/contestnew/show/12006 我是比赛完后在去写的 这是我第一次打洛谷月赛,之前一次是比赛完才去看而且写了第一题就没写后面的了 284分,太水 ...

  7. "AssertionError: View function mapping is overwriting an existing endpoint function"如何解决

    使用Flask定义URL的时候,如果出现"AssertionError: View function mapping is overwriting an existing endpoint ...

  8. BZOJ 3930 Luogu P3172 选数 (莫比乌斯反演)

    手动博客搬家:本文发表于20180310 11:46:11, 原地址https://blog.csdn.net/suncongbo/article/details/79506484 题目链接: (Lu ...

  9. 【hihocoder 1473】小Ho的强迫症

    [题目链接]:http://hihocoder.com/problemset/problem/1473 [题意] [题解] 假定初始为在在0位置(相对它左边那条线); 则考虑; 多少步之后,人又能这到 ...

  10. 设置Jmeter默认中文页面

    下载安装好Jmeter后默认的是英文,对于我这种学渣来说简直就是受到了1000000点攻击. 所以,如何把英文界面换成中文呢? 方法一(从网上看到的) 启动Jmeter找到 options >c ...