I have been puzzled.大家快来看看这道题目:

idler 2001-10-11 10:23:09
A Game
IOI'96 - Day 1
Consider the following two-player game played with a sequence of N positive integers (2 <= N <= 100) laid onto a game board. Player 1 starts the game. The players move alternately by selecting a number from either the left or the right end of the sequence. That number is then deleted from the board, and its value is added to the score of the player who selected it. A player wins if his sum is greater than his opponents.

If the board initially contains an even number of elements, then Player 1 has a strategy that guarantees a win or a tie. Write a program that implements the optimal winning strategy. The optimal strategy yields maximum points when playing against the "best possible" opponent. Your program must further implement an optimal strategy for player 2.

PROGRAM NAME: game1
INPUT FORMAT
Line 1: N, the size of the board
Line 2-etc: N integers in the range (1..200) that are the contents of the game board, from left to right

SAMPLE INPUT (file game1.in)
6
4 7 2 9
5 2

OUTPUT FORMAT
Two space-separated integers on a line: the score of Player 1 followed by the score of Player 2.
SAMPLE OUTPUT (file game1.out)
18 11

看上去就是IOI '96的第一题,但是下面的数据却不对:
30
105 57 64 79 188 102 52 145 188 2 163 147 174 163 198 9 133 159 184 104 70
19 57 174 184 57 154 123 106 129
...全文
140 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
alwzh 2001-10-12
  • 打赏
  • 举报
回复
请译为中文

33,028

社区成员

发帖
与我相关
我的任务
社区描述
数据结构与算法相关内容讨论专区
社区管理员
  • 数据结构与算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧