链接:https://ac.nowcoder.com/acm/contest/330/A
来源:牛客网
时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 262144K,其他语言524288K
64bit IO Format: %lld
题目描述
Applese 和 Bpplese 在玩取石子游戏,规则如下:
一共有偶数堆石子排成一排,每堆石子的个数为
a
i
ai。两个人轮流取石子,Applese先手。每次取石子只能取最左一堆或最右一堆,且必须取完。最后取得的石子多者获胜。假设双方都足够聪明,最后谁能够获胜呢?
输入描述:
第一行是一个正偶数 n,表示石子的堆数。
第二行是 n 个正整数
a
1
,
a
2
,
…
,
a
n
a1,a2,…,an,表示每堆石子的个数。
输出描述:
输出一个字符串“Applese”或“Bpplese”,表示胜者的名字。
示例1
输入
复制
4
2 3 3 3
输出
复制
Applese
备注:
2
≤
n
≤
10
5
2≤n≤105
1
≤
a
i
≤
10
5
1≤ai≤105
∑
a
i
∑ai 为奇数
思路:很简单的博弈论
AC代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int []num=new int[n];
for(int i=0;i<n;i++){
num[i]=sc.nextInt();
}
System.out.println("Applese");
sc.close();
}
}