Codeforces Round #258 (Div. 2)

A. Game With Sticks
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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 test(s)
Input
2 2
Output
Malvika
Input
2 3
Output
Malvika
Input
3 3
Output
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.

题意:给出m根横棒,n根竖棒,交叉摆出n*m个交点,两人轮流,每次选一个交点,拿走过这个交点的两个棒。最后没得选的人输。输出胜者。

题解:

水题,每次会少一行一列,行或者列没有了就结束了,所以只用看行和列中少的那一个。

 //#pragma comment(linker, "/STACK:102400000,102400000")
#include<cstdio>
#include<cmath>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
using namespace std;
#define ll long long
#define usint unsigned int
#define mz(array) memset(array, 0, sizeof(array))
#define minf(array) memset(array, 0x3f, sizeof(array))
#define REP(i,n) for(i=0;i<(n);i++)
#define FOR(i,x,n) for(i=(x);i<=(n);i++)
#define RD(x) scanf("%d",&x)
#define RD2(x,y) scanf("%d%d",&x,&y)
#define RD3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define WN(x) printf("%d\n",x);
#define RE freopen("D.in","r",stdin)
#define WE freopen("1biao.out","w",stdout) int main(){
int n,m;
scanf("%d%d",&n,&m);
n=min(n,m);
if(n%==) puts("Malvika");
else puts("Akshat");
return ;
}

CF451A Game With Sticks 水题的更多相关文章

  1. Codeforces Round #258 (Div. 2) A. Game With Sticks 水题

    A. Game With Sticks 题目连接: http://codeforces.com/contest/451/problem/A Description After winning gold ...

  2. hdu 1051:Wooden Sticks(水题,贪心)

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

  3. 【转】POJ百道水题列表

    以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...

  4. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  5. ACM :漫漫上学路 -DP -水题

    CSU 1772 漫漫上学路 Time Limit: 1000MS   Memory Limit: 131072KB   64bit IO Format: %lld & %llu Submit ...

  6. ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)

    1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 154  Solved: 112[ ...

  7. [poj2247] Humble Numbers (DP水题)

    DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...

  8. gdutcode 1195: 相信我这是水题 GDUT中有个风云人物pigofzhou,是冰点奇迹队的主代码手,

    1195: 相信我这是水题 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 821  Solved: 219 Description GDUT中有个风云人 ...

  9. BZOJ 1303 CQOI2009 中位数图 水题

    1303: [CQOI2009]中位数图 Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 2340  Solved: 1464[Submit][Statu ...

随机推荐

  1. .net社区

    英文社区: 名称:MSDN 地址:http://msdn.microsoft.com/zh-cn/default.aspx 描述:这个网站是大家学.Net的初始网站,也是.net方面官方和权威的资料, ...

  2. BZOJ2038 小z的袜子

    题意:给一些数,然后每次询问一段区间,问从这个区间中抽走两个数,抽到相同的数的概率 正解:莫队算法 今天新学习了莫队算法,感觉好神,离线的询问好像都可以用莫队. 要不是坑爹的HNOI2016考了两道莫 ...

  3. SQL Server表结构和数据导入到MySQL

    借助的工具:Navicat for MySQL,链接:http://pan.baidu.com/s/1kVCw8IF 密码:g927 可以很明确的肯定,主键和自增列是没办法导入的,只能是表结构和数据. ...

  4. 素材收集(icon/images/javascript)

    icon: http://www.easyicon.net/ http://www.iconpng.com/ images: http://www.58pic.com/tupian/fenxiangt ...

  5. CCNET+ProGet+Windows Batch搭建全自动的内部包打包和推送及管理平台

    所要用的工具: 1.CCNET(用于检测SVN有改动提交时自动构建,并运行nuget的自动打包和推送批处理) 2.ProGet(目前见到最好用的nuget内部包管理平台) 3.Windows Batc ...

  6. java的静态代理和动态代理(jdk、cglib)

    一.代理模式 代理的概念来自于设计模式中的代理模式,先了解一下代理模式 1.结构图 2.参与者 Subject:接口,定义代理类和实际类的共用接口 RealSubject:实际类,实现Subject这 ...

  7. Django REST framework简单使用

    详细的见 https://github.com/linux-wang/DRF_tutorial/blob/master/README.md DRF中有一个serializer的概念,实现的功能是将各种 ...

  8. DOM参考手册及事件参考手册

    给全局HTML DOM元素增加函数的方法 HTMLElement.prototype.hasClass = function (className) { return new RegExp(" ...

  9. BZOJ3282: Tree

    传送门 又是权限题= =,过了NOIp我就要去当一只权限狗! LCT裸题,get到了两个小姿势. 1.LCA操作应该在access中随时updata 2.Link操作可以更简单 void Link(i ...

  10. UVA11624Fire!(BFS)

    题目链接 题意:帮助joe走出一个大火蔓延的迷宫,其中joe每分钟可往上下左右四个方向之一走,所有着火的格子都会蔓延(空格与着火格有公共边,下一分钟这个空格也会着火).迷宫中有一些障碍格,joe和火都 ...