题目
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
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的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
热门考点
- 1make preparation for不对吗?为什么?
- 2Can you ( A.dance B.dancing C.dances
- 3宾语前置的标志有哪些?
- 4六【1】班今天的出勤率为98%,1人未到,这个班一共有【?】人.
- 5What shall we [prefer for ]the picnic?与prefer for 相近的 1.be ready for 2.leave for 3.go to 4.get to.
- 6六(1)班同学40人参加植树活动,男生每人种3棵树,女生每人种2棵树.已知男生比女生多种30棵树,问,男、女生
- 7It makes__(surf)the Internet more convenient.请问这里应该怎么填呀?
- 8信达学校买了4个足球和5个排球 一共用去560元 如果买2个足球
- 9英语翻译
- 10在中,"常著文章自娱,颇示己志"中的"颇"是什么意思?