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

« 1 2» Pages: ( 1/2 total )
本页主题: [活动]程序区活动第二期——Magnificent Meatballs 显示签名 | 打印 | 加为IE收藏 | 收藏主题 | 上一主题 | 下一主题

zhd32



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

5come5帮你背单词 [ groceries // 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 | [楼 主]
yinx



性别: 帅哥 状态: 该用户目前不在线
等级: 人见人爱
家族: 丢丢
发贴: 2333
威望: 0
浮云: 1260
在线等级:
注册时间: 2006-09-15
最后登陆: 2009-05-11

5come5帮你背单词 [ spokesman /'spəuksmən/ n. 发言人,代言人 ]


对不起!您没有登陆,请先登录论坛.



[ 此帖被yinx在2007-11-26 13:57重新编辑 ]
本帖最近评分记录:
  • 浮云:10(zhd32) 不错不错~~
  • 顶端 Posted: 2007-11-26 13:09 | [1 楼]
    清杯



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

    5come5帮你背单词 [ welcome /'welkəm/ a. 受欢迎;v. n. & int. 欢迎 ]


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



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

    5come5帮你背单词 [ perceive /pə'si:v/ vt. 察觉,感知,领悟 ]


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



    性别: 帅哥 状态: 该用户目前不在线
    等级: 品行端正
    发贴: 407
    威望: 0
    浮云: 1105
    在线等级:
    注册时间: 2006-06-15
    最后登陆: 2009-05-14

    5come5帮你背单词 [ antarctica /æn'ta:ktikə/ n. 南极洲 ]


    对不起!您没有登陆,请先登录论坛.
    本帖最近评分记录:
  • 浮云:10(zhd32)
  • 顶端 Posted: 2007-11-26 14:03 | [4 楼]
    清杯



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

    5come5帮你背单词 [ discriminate /dis'krimineit/ v. 区别,辨别,区分,有差别地对待,歧视 ]


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



    性别: 帅哥 状态: 该用户目前不在线
    等级: 品行端正
    发贴: 292
    威望: 0
    浮云: 1105
    在线等级:
    注册时间: 2006-09-21
    最后登陆: 2009-03-16

    5come5帮你背单词 [ injustice /in'd3əΛstis/ n. 不公正,不公平 ]


    2946919    hhb    1247    Accepted    72K    0MS    C++    433B    2007-11-26 19:51:41
    其实这题无论是时间还是内存都没有比的价值……
    对不起!您没有登陆,请先登录论坛.
    本帖最近评分记录:
  • 浮云:10(zhd32) GG是搞ACM的当然这么说咯~加起
  • 顶端 Posted: 2007-11-26 19:57 | [6 楼]
    hhbhhb



    性别: 帅哥 状态: 该用户目前不在线
    等级: 品行端正
    发贴: 292
    威望: 0
    浮云: 1105
    在线等级:
    注册时间: 2006-09-21
    最后登陆: 2009-03-16

    5come5帮你背单词 [ ink // n. 墨水,油墨 ]


    来稍微增加点难度吧。假设起始位置是不确定的,可以从任何地方开始,问是否能够等分。N的范围定在10^5左右吧。。时限不变。。其实可以想到O(n)的方法,大牛们不要说哈……
    对不起!您没有登陆,请先登录论坛.



    [ 此帖被hhbhhb在2007-11-26 20:35重新编辑 ]
    顶端 Posted: 2007-11-26 20:23 | [7 楼]
    hhbhhb



    性别: 帅哥 状态: 该用户目前不在线
    等级: 品行端正
    发贴: 292
    威望: 0
    浮云: 1105
    在线等级:
    注册时间: 2006-09-21
    最后登陆: 2009-03-16

    5come5帮你背单词 [ ounce /auns/ n. 盎司,少量 ]


    本帖最近评分记录:
    # 浮云:10(zhd32) GG是搞ACM的当然这么说咯~加起

    最后的裁定还是按大家程序的运行时间和空间来确定,时间越短,空间越小越好

    其实我的意思是这样就分不出名次了……
    顶端 Posted: 2007-11-26 20:51 | [8 楼]
    yinx



    性别: 帅哥 状态: 该用户目前不在线
    等级: 人见人爱
    家族: 丢丢
    发贴: 2333
    威望: 0
    浮云: 1260
    在线等级:
    注册时间: 2006-09-15
    最后登陆: 2009-05-11

    5come5帮你背单词 [ bean /bi:n/ n. 豆,蚕豆,豆科植物 ]


    Quote:
    引用第6楼hhbhhb于2007-11-26 19:57发表的  :
    2946919    hhb    1247    Accepted    72K    0MS    C++    433B    2007-11-26 19:51:41
    其实这题无论是时间还是内存都没有比的价值……
    浏览此帖需要威望


    我是很想知道你用的Memory为什么只有72K
    我弄来弄去最小也要112K

    等公布答案的时候我来看你的程序
    顶端 Posted: 2007-11-26 20:58 | [9 楼]
    清杯



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

    5come5帮你背单词 [ settler /'setlə/ n. 移居者,开拓者 ]


    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 | [10 楼]
    hhbhhb



    性别: 帅哥 状态: 该用户目前不在线
    等级: 品行端正
    发贴: 292
    威望: 0
    浮云: 1105
    在线等级:
    注册时间: 2006-09-21
    最后登陆: 2009-03-16

    5come5帮你背单词 [ salesman /'seilzmən/ n. 售货员 ]


    Quote:
    引用第10楼清杯于2007-11-26 21:13发表的  :

    问个很弱的问题。。。。。这个在哪儿看的哦?

    http://acm.pku.edu.cn/JudgeOnline/problem?id=1247
    到POJ上交一次就可以看到了……
    顶端 Posted: 2007-11-26 21:16 | [11 楼]
    hhbhhb



    性别: 帅哥 状态: 该用户目前不在线
    等级: 品行端正
    发贴: 292
    威望: 0
    浮云: 1105
    在线等级:
    注册时间: 2006-09-21
    最后登陆: 2009-03-16

    5come5帮你背单词 [ bright /brait/ a. 明亮的,光明的,晴朗的,欢快的,兴高采烈的,聪明的,(颜色)鲜艳的 ]


    Quote:
    引用第9楼yinx于2007-11-26 20:58发表的  :


    我是很想知道你用的Memory为什么只有72K
    我弄来弄去最小也要112K

    .......

    这个基本可以认为是在误差允许范围内……
    顶端 Posted: 2007-11-26 21:17 | [12 楼]
    yinx



    性别: 帅哥 状态: 该用户目前不在线
    等级: 人见人爱
    家族: 丢丢
    发贴: 2333
    威望: 0
    浮云: 1260
    在线等级:
    注册时间: 2006-09-15
    最后登陆: 2009-05-11

    5come5帮你背单词 [ authentic /o:'θentik/ a. 真的,真正的,可靠的,可信的 ]


    开关我是这样写的
    Copy code
                scanf("%d",&tmp);           
                mb[i]=tmp;
                sum+=mb[i];

    用了120K

    后来改成这样
    Copy code
                scanf("%d",&mb[i]);           
                sum+=mb[i];

    并把tmp的声明删掉,用了112K
    好像很精确的呀
    顶端 Posted: 2007-11-26 21:46 | [13 楼]
    hhbhhb



    性别: 帅哥 状态: 该用户目前不在线
    等级: 品行端正
    发贴: 292
    威望: 0
    浮云: 1105
    在线等级:
    注册时间: 2006-09-21
    最后登陆: 2009-03-16

    5come5帮你背单词 [ yet /jet/ conj. 然而,不过;ad. 到目前为止,现在还,更,还,沿,仍然 ]


    你不会是用G++交的吧。。那换C++……
    其实这种问题和编译器有关系,如果用汇编写估计还要小得多。。所以比这个没意义啦。。

    我的加强版没人做吗……
    顶端 Posted: 2007-11-26 21:48 | [14 楼]
    « 1 2» Pages: ( 1/2 total )
    我来我网·5come5 Forum » 程序员之家

    Total 0.016620(s) query 7, Time now is:06-01 03:38, Gzip enabled
    Powered by PHPWind v5.3, Localized by 5come5 Tech Team, 黔ICP备16009856号