| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3916 人关注过本帖, 1 人收藏
标题:随机中的有序,混乱中的美丽
只看楼主 加入收藏
Devil_W
Rank: 10Rank: 10Rank: 10
等 级:青峰侠
威 望:9
帖 子:1160
专家分:1797
注 册:2009-9-14
收藏
得分:0 
以下是引用BlueGuy在2010-12-22 12:45:53的发言:

你那题目太偏了, 你搞个 "我今年多大?", 我一样答不出来,/
是你狗屎还是题目狗屎?



我简直无语。。。 你太犀利了。。。就一道简单的DP 你就说题目太偏了。。。
2010-12-22 12:47
BlueGuy
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:29
帖 子:4476
专家分:4055
注 册:2009-4-18
收藏
得分:0 
以下是引用无尽苍穹在2010-12-22 12:46:58的发言:

呵呵 要注册啊..可以直接把原题发上来么
出个帖目都这么麻烦,/

我就是真命天子,顺我者生,逆我者死!
2010-12-22 12:48
Devil_W
Rank: 10Rank: 10Rank: 10
等 级:青峰侠
威 望:9
帖 子:1160
专家分:1797
注 册:2009-9-14
收藏
得分:0 
Question Description:

You have been given a list of jewelry items that must be split amongst two people: Frank and Bob. Frank likes very expensive jewelry. Bob doesn't care how expensive the jewelry is, as long as he gets a lot of jewelry. Based on these criteria you have devised the following policy:
1) Each piece of jewelry given to Frank must be valued greater than or equal to each piece of jewelry given to Bob. In other words, Frank's least expensive piece of jewelry must be valued greater than or equal to Bob's most expensive piece of jewelry.
2) The total value of the jewelry given to Frank must exactly equal the total value of the jewelry given to Bob.
3) There can be pieces of jewelry given to neither Bob nor Frank.
4) Frank and Bob must each get at least 1 piece of jewelry.
Given the value of each piece, you will determine the number of different ways you can allocate the jewelry to Bob and Frank following the above policy. For example:
    values = {1,2,5,3,4,5}
Valid allocations are:
  Bob               Frank
  1,2                 3
  1,3                 4
  1,4                 5  (first 5)
  1,4                  5  (second 5)
  2,3                  5  (first 5)
  2,3                  5  (second 5)
   5  (first 5)         5  (second 5)
   5  (second 5)     5  (first 5)
1,2,3,4               5,5
Note that each '5' is a different piece of jewelry and needs to be accounted for separately. There are 9 legal ways of allocating the jewelry to Bob and Frank given the policy, so your method would return 9.
 
Definition
        
Class:    Jewelry
Method:    howMany
Parameters:    int[]
Returns:    long
Method signature:    long howMany(int[] values)
(be sure your method is public)
   
 
Constraints
-    values will contain between 2 and 30 elements inclusive.
-    Each element of values will be between 1 and 1000 inclusive.
 
Examples
0)   
        
{1,2,5,3,4,5}
Returns: 9
From above.
1)   
        
{1000,1000,1000,1000,1000,
 1000,1000,1000,1000,1000,
 1000,1000,1000,1000,1000,
 1000,1000,1000,1000,1000,
 1000,1000,1000,1000,1000,
 1000,1000,1000,1000,1000}
Returns: 18252025766940
2)   
        
{1,2,3,4,5}
Returns: 4
Valid allocations:
Bob               Frank
1,2                 3
2,3                 5
1,3                 4
1,4                 5
3)   
        
{7,7,8,9,10,11,1,2,2,3,4,5,6}
Returns: 607
4)   
        
{123,217,661,678,796,964,54,111,417,526,917,923}
Returns: 0
2010-12-22 12:48
BlueGuy
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:29
帖 子:4476
专家分:4055
注 册:2009-4-18
收藏
得分:0 
以下是引用Devil_W在2010-12-22 12:47:36的发言:

 
 
 
我简直无语。。。 你太犀利了。。。就一道简单的DP 你就说题目太偏了。。。
我再说一句: 题目帖出来,
没有像样的题目我直接无视了。

我就是真命天子,顺我者生,逆我者死!
2010-12-22 12:49
无尽苍穹
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:44
专家分:101
注 册:2007-3-28
收藏
得分:0 
以下是引用Devil_W在2010-12-22 11:27:44的发言:

 
 
谁怕谁?
 
 
代码你可以从这里去拿,
 
刚好有个lib没写结束,实现NAT穿越。
呵呵 这些源码都是开源的? 佩服啊!
能写的人多,但开源的却少!
2010-12-22 12:50
ququguoguo
Rank: 2
等 级:论坛游民
帖 子:73
专家分:90
注 册:2010-10-20
收藏
得分:5 
真的好美丽唉
2010-12-22 12:57
vandychan
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
等 级:贵宾
威 望:18
帖 子:2296
专家分:6418
注 册:2010-8-20
收藏
得分:5 
好美丽

到底是“出来混迟早要还”还是“杀人放火金腰带”?
2010-12-22 12:59
无尽苍穹
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:44
专家分:101
注 册:2007-3-28
收藏
得分:0 
不知道我题目理解的对不:
一堆珠宝两个人分 ,一个要保证最贵,一个要保证最多,珠宝可以不用分完
要满足 两个分的总额必须相等 要最贵的那个必须保证他最便宜的都不能比对方最贵的价值低(可以等)
要量多的那个要保证得到的珠宝数必须大于等于贵的那个

输入 珠宝的价值 然后输出有多少种分法
2010-12-22 13:03
vandychan
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
等 级:贵宾
威 望:18
帖 子:2296
专家分:6418
注 册:2010-8-20
收藏
得分:0 
不是图像吗??怎么宝珠了?

到底是“出来混迟早要还”还是“杀人放火金腰带”?
2010-12-22 14:22
xufan123
Rank: 5Rank: 5
等 级:职业侠客
帖 子:226
专家分:318
注 册:2010-11-15
收藏
得分:0 
用不着这样吧!
2010-12-22 17:34
快速回复:随机中的有序,混乱中的美丽
数据加载中...
 
   



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

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