当前位置: > ACM博弈问题,求给思路...
题目
ACM博弈问题,求给思路
Problem Description
Alice
and Bob are playing a game.There are two piles of cards.There are N
cards in each pile,and each card has a score.They take turns
to pick up the top or bottom card from either pile,and the score
of the card will be added to his total score.Alice and Bob are both
clever enough,and will pick up cards to get as many scores as possible.
Do you know how many scores can Alice get if he picks up first?
Input
The first line contains an integer T (T≤100),indicating the number of cases.
Each case contains 3 lines.The first line is the N (N≤20).The second line contains N integer ai (1≤ai≤10000).The third line contains N integer bi (1≤bi≤10000).
Output
For each case,output an integer,indicating the most score Alice can get.
SampleInput
2
1
23
53
3
10 100 20
2 4 3
SampleOutput
53
105

提问时间:2021-03-29

答案
#include<cstdio>#include<algorithm>using namespace std;const int N = 23;int x[N][N][N][N], y[N][N][N][N];int n, A[N], B[N];int&nb...
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
版权所有 CopyRight © 2012-2019 超级试练试题库 All Rights Reserved.