CF850C.Arpa and a game with Mojtaba
提高+/省选-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Mojtaba and Arpa are playing a game. They have a list of n numbers in the game.
In a player's turn, he chooses a number p__k (where p is a prime number and k is a positive integer) such that p__k divides at least one number in the list. For each number in the list divisible by p__k, call it x, the player will delete x and add
to the list. The player who can not make a valid choice of p and k loses.
Mojtaba starts the game and the players alternatively make moves. Determine which one of players will be the winner if both players play optimally.
莫杰塔巴和阿尔帕正在玩一个游戏。游戏中有一个包含 n 个数字的列表。
在一名玩家的回合中,他需选择一个形如 pk 的数(其中 p 是质数,k 为正整数),使得 pk 至少能整除列表中的一个数。对于列表中每一个能被 pk 整除的数 x,该玩家将删除 x,并把
加入列表。若某位玩家无法选出满足条件的 p 和 k,则该玩家输掉游戏。
莫杰塔巴先手,双方轮流进行操作。假设双方均以最优策略进行游戏,请判断哪位玩家将获胜。
输入格式
The first line contains a single integer n (1 ≤ n ≤ 100) — the number of elements in the list.
The second line contains n integers _a_1, _a_2, ..., a__n (1 ≤ a__i ≤ 109) — the elements of the list.
第一行包含一个整数 n(1 ≤ n ≤ 100)—— 表示列表中元素的个数。
第二行包含 n 个整数 a1, a2, ..., an(1 ≤ ai ≤ 109)—— 表示列表中的元素。
输出格式
If Mojtaba wins, print "Mojtaba", otherwise print "Arpa" (without quotes).
You can print each letter in any case (upper or lower).
如果莫赫塔巴获胜,则输出 “Mojtaba”,否则输出 “Arpa”(不带引号)。
每个字母可以以任意大小写形式输出(大写或小写)。
输入输出样例
输入#1
4 1 1 1 1
输出#1
Arpa
输入#2
4 1 1 17 17
输出#2
Mojtaba
输入#3
4 1 1 17 289
输出#3
Arpa
输入#4
5 1 2 3 4 5
输出#4
Arpa
说明/提示
In the first sample test, Mojtaba can't move.
In the second sample test, Mojtaba chooses p = 17 and k = 1, then the list changes to [1, 1, 1, 1].
In the third sample test, if Mojtaba chooses p = 17 and k = 1, then Arpa chooses p = 17 and k = 1 and wins, if Mojtaba chooses p = 17 and k = 2, then Arpa chooses p = 17 and k = 1 and wins.
在第一个样例测试中,Mojtaba 无法进行操作。
在第二个样例测试中,Mojtaba 选择 p=17 和 k=1,则列表变为 [1, 1, 1, 1]。
在第三个样例测试中,若 Mojtaba 选择 p=17 和 k=1,则 Arpa 选择 p=17 和 k=1 并获胜;若 Mojtaba 选择 p=17 和 k=2,则 Arpa 选择 p=17 和 k=1 并获胜。
输入解题思路,AI测评打分。不知道怎么写?