我来我网
https://5come5.cn
 
您尚未 登录  注册 | 菠菜 | 软件站 | 音乐站 | 邮箱1 | 邮箱2 | 风格选择 | 更多 » 
 

本页主题: [活动]程序区活动第二期——Magnificent Meatballs 显示签名 | 打印 | 加为IE收藏 | 收藏主题 | 上一主题 | 下一主题

zhd32



性别: 帅哥 状态: 该用户目前不在线
等级: 版主
家族: YD一族
发贴: 619
威望: 0
浮云: 543
在线等级:
注册时间: 2006-04-22
最后登陆: 2009-06-22

5come5帮你背单词 [ purchase /'pə:təs/ vt. 购买;n. 购买,购买的物品 ]


[活动]程序区活动第二期——Magnificent Meatballs

本帖被 zhd32 执行提前操作(2007-11-26)
Quote:

Magnificent Meatballs
Time Limit: 1000MSMemory Limit: 10000K
Total Submissions: 1925Accepted: 1315
Description
Sam and Ella run a catering service. They like to put on a show when serving meatballs to guests seated at round tables. They march out of the kitchen with pots of meatballs and start serving adjacent guests. Ella goes counterclockwise and Sam goes clockwise, until they both plop down their last meatball, at the same time, again at adjacent guests. This impressive routine can only be accomplished if they can divide the table into two sections, each having the same number of meatballs. You are to write a program to assist them.

At these catering events, each table seats 2 <= N <= 30 guests. Each guest orders at least one and at most nine meatballs. Each place at the table is numbered from 1 to N, with the host at position 1 and the host's spouse at position N. Sam always serves the host first then proceeds to serve guests in increasing order. Ella serves the spouse first, then serves guests in decreasing order. The figures illustrate the first two example input cases.

Input
Input consists of one or more test cases. Each test case contains the number of guests N followed by meatballs ordered by each guest, from guest 1 to guest N. The end of the input is a line with a single zero.


Output
For each table, output a single line with the ending positions for Sam and Ella, or the sentence indicating an equal partitioning isn't possible. Use the exact formatting shown below.

Sample Input

5 9 4 2 8 3
5 3 9 4 2 8
6 1 2 1 2 1 2
6 1 2 1 2 1 1
0

Sample Output

Sam stops at position 2 and Ella stops at position 3.
No equal partitioning.
No equal partitioning.
Sam stops at position 3 and Ella stops at position 4.


代码格式:
请将自己的代码写入到标签 [ code] [ /code]中(注:code前面是没有空格的,因为网页显示的问题,我加了一个空格),将自己的代码加密至少100以上,违者将会扣除FY的哈,所以请注意

最后的裁定还是按大家程序的运行时间和空间来确定,时间越短,空间越小越好
参与者每人10FY
第一名50
第二名40
第三名30




[ 此帖被zhd32在2007-11-26 11:27重新编辑 ]
顶端 Posted: 2007-11-26 11:21 | [楼 主]
清杯



性别: 帅哥 状态: 该用户目前不在线
等级: 品行端正
家族: 菠韬汹勇
发贴: 360
威望: 0
浮云: 1115
在线等级:
注册时间: 2006-09-23
最后登陆: 2008-06-29

5come5帮你背单词 [ ventilate /'ventileit/ vt. 使通风,使空气流通 ]


对不起!您没有登陆,请先登录论坛.
顶端 Posted: 2007-11-26 14:01 | [1 楼]
清杯



性别: 帅哥 状态: 该用户目前不在线
等级: 品行端正
家族: 菠韬汹勇
发贴: 360
威望: 0
浮云: 1115
在线等级:
注册时间: 2006-09-23
最后登陆: 2008-06-29

5come5帮你背单词 [ spouse /spauz/ n. 配偶 ]


参与有奖哦~~~~~~~
本帖最近评分记录:
  • 浮云:10(zhd32) 谢谢提醒
  • 顶端 Posted: 2007-11-26 14:03 | [2 楼]
    清杯



    性别: 帅哥 状态: 该用户目前不在线
    等级: 品行端正
    家族: 菠韬汹勇
    发贴: 360
    威望: 0
    浮云: 1115
    在线等级:
    注册时间: 2006-09-23
    最后登陆: 2008-06-29

    5come5帮你背单词 [ sturdy /'stə:di/ a. 强健的,结实的,坚定的,不屈不挠的 ]


    我们三个人把奖分了算了。。。。。。浮云浮云浮云浮云浮云浮云  
    顶端 Posted: 2007-11-26 14:09 | [3 楼]
    清杯



    性别: 帅哥 状态: 该用户目前不在线
    等级: 品行端正
    家族: 菠韬汹勇
    发贴: 360
    威望: 0
    浮云: 1115
    在线等级:
    注册时间: 2006-09-23
    最后登陆: 2008-06-29

    5come5帮你背单词 [ digital /'did3əitl/ a. 数字的 ]


    Quote:
    引用第6楼hhbhhb于2007-11-26 19:57发表的  :
    2946919    hhb    1247    Accepted    72K    0MS    C++    433B    2007-11-26 19:51:41

    问个很弱的问题。。。。。这个在哪儿看的哦?
    顶端 Posted: 2007-11-26 21:13 | [4 楼]
    我来我网·5come5 Forum » 程序员之家

    Total 0.009456(s) query 6, Time now is:11-22 17:16, Gzip enabled
    Powered by PHPWind v5.3, Localized by 5come5 Tech Team, 黔ICP备16009856号