| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 415 人关注过本帖
标题:数组问题求解
只看楼主 加入收藏
袁野
Rank: 2
来 自:湖北省
等 级:论坛游民
帖 子:45
专家分:56
注 册:2010-10-13
结帖率:100%
收藏
已结贴  问题点数:10 回复次数:4 
数组问题求解
关于“赌博”的问题
As Manuel wants to get rich fast and without too much work, he decided to make a career in gambling. Initially, he plans to study the gains and losses of players, so that, he can identify patterns of consecutive wins and elaborate a winwin strategy. But Manuel, as smart as he thinks he is, does not know how to program computers. So he hired you to write programs that will assist him in elaborating his strategy.

Your first task is to write a program that identifies the maximum possible gain out of a sequence of bets. A bet is an amount of money and is either winning (and this is recorded as a positive value), or losing (and this is recorded as a negative value).

Input
The input set consists of a positive number N <= 10000 , that gives the length of the sequence, followed by N integers. Each bet is an integer greater than 0 and less than 1000.
The input is terminated with N = 0.

Output
For each given input set, the output will echo a line with the corresponding solution. If the sequence shows no possibility to win money, then the output is the message "Losing streak."
Sample Input
5
12 -4 -10 4 9
3
-2 -1 -2
0
Sample Output
The maximum winning streak is 13.
Losing streak.
Thanks To
Problem setter: David Dehar
搜索更多相关主题的帖子: 问题求解 
2010-11-07 12:21
ou1111
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:87
专家分:162
注 册:2010-10-26
收藏
得分:2 
全英文,最讨厌了
2010-11-07 13:01
MrBluer
Rank: 4
等 级:业余侠客
威 望:1
帖 子:120
专家分:263
注 册:2010-10-23
收藏
得分:2 
如果你全翻译为中文再发帖该多好啊
2010-11-07 13:08
bc121189971
Rank: 2
来 自:深圳
等 级:论坛游民
帖 子:29
专家分:36
注 册:2010-9-27
收藏
得分:2 
貌似是ACM...

to be or not to be
2010-11-07 13:08
袁野
Rank: 2
来 自:湖北省
等 级:论坛游民
帖 子:45
专家分:56
注 册:2010-10-13
收藏
得分:0 
求代码
2010-11-07 14:12
快速回复:数组问题求解
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.049349 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved