首页 > ACM题库 > HDU-杭电 > HDU 3569-Imaginary Date[解题报告]HOJ
2014
11-27

HDU 3569-Imaginary Date[解题报告]HOJ

Imaginary Date

问题描述 :

XMM met his ex-girlfriend on Double Seventh Festival Day. Though what happened between these two little kids was in the past, there did exist some strange and complicated feelings or something you can call it desire, which XMM cannot deny and tried as hard as he can to keep those things inside to ensure nobody else knows. But as his friends, just to be clear, it is so obvious to us.

So, today is a day. How could XMM possibly give up this wonderful chance? He once again asked XLZ out and then took her to a nice restaurant and prepared to give some delicious chocolate to XLZ to satisfy her which we think is useless.

There are n kinds of chocolate in the restaurant, XLZ likes them in varying degrees. To simplify this, every chocolate have a integer value vi(1 <= vi <= 1000 for all 1 <= i <= n <= 1000). This implies how much XLZ likes it. But since it has been such a long time that XMM Broke up with XLZ, XMM didn’t know it. So he’d like to randomly choose a chocolate every minute to give it to her. The total time XMM has is m minutes (1 <= m <= 1000).But there is another restriction: the kitchen is not so effective so after XMM buy a chocolate, it needs k (1 <= k <= n) minutes to make this kind of chocolate which means the next time XMM can order this is at least k minutes later.

Now we want to know the expect value XLZ gets on that special night.

输入:

The first line is a single integer T indicating the number of cases that follow.
For each case, three integers n, m, k are give in the first line which is mentioned above.
The next line contains n integers which are the value of the n chocolates.

输出:

The first line is a single integer T indicating the number of cases that follow.
For each case, three integers n, m, k are give in the first line which is mentioned above.
The next line contains n integers which are the value of the n chocolates.

样例输入:

2

3 3 1
1 3 5

4 4 4
1 2 3 4

样例输出:

Case 1: 9.00000
Case 2: 10.00000

#include<stdio.h>
#include<string.h>
int main()
{
	int i,j,n,m,k,h,t,x;
	double sum=0.0;
	scanf("%d",&t);
	for(h=1;h<=t;h++)
	{
		scanf("%d%d%d",&n,&m,&k);
		sum=0;
		for(i=1;i<=n;i++)
		{
			scanf("%d",&x);
			sum+=x;
		}
		sum=1.0*sum*m/n;
		printf("Case %d: %.5lf\n",h,sum);
	}
	return 0;
}

  1. 文章的中心说白了,就是美国希望中国拿出制裁朝鲜的得力措施,而中国担心失去了朝鲜这个“同质”小兄弟,使自己在周边邻国中更加孤立,所以即使金三继续核试挑战,危及中国安全,中国宁可冒着这个巨大风险,也不让美国借此壮大力量。可见,在中央高层的心目中,朝鲜边境的中

  2. 文章的中心说白了,就是美国希望中国拿出制裁朝鲜的得力措施,而中国担心失去了朝鲜这个“同质”小兄弟,使自己在周边邻国中更加孤立,所以即使金三继续核试挑战,危及中国安全,中国宁可冒着这个巨大风险,也不让美国借此壮大力量。可见,在中央高层的心目中,朝鲜边境的中

  3. 文章的中心说白了,就是美国希望中国拿出制裁朝鲜的得力措施,而中国担心失去了朝鲜这个“同质”小兄弟,使自己在周边邻国中更加孤立,所以即使金三继续核试挑战,危及中国安全,中国宁可冒着这个巨大风险,也不让美国借此壮大力量。可见,在中央高层的心目中,朝鲜边境的中

  4. 文章的中心说白了,就是美国希望中国拿出制裁朝鲜的得力措施,而中国担心失去了朝鲜这个“同质”小兄弟,使自己在周边邻国中更加孤立,所以即使金三继续核试挑战,危及中国安全,中国宁可冒着这个巨大风险,也不让美国借此壮大力量。可见,在中央高层的心目中,朝鲜边境的中

  5. 文章的中心说白了,就是美国希望中国拿出制裁朝鲜的得力措施,而中国担心失去了朝鲜这个“同质”小兄弟,使自己在周边邻国中更加孤立,所以即使金三继续核试挑战,危及中国安全,中国宁可冒着这个巨大风险,也不让美国借此壮大力量。可见,在中央高层的心目中,朝鲜边境的中

  6. 文章的中心说白了,就是美国希望中国拿出制裁朝鲜的得力措施,而中国担心失去了朝鲜这个“同质”小兄弟,使自己在周边邻国中更加孤立,所以即使金三继续核试挑战,危及中国安全,中国宁可冒着这个巨大风险,也不让美国借此壮大力量。可见,在中央高层的心目中,朝鲜边境的中

  7. 有两个重复的话结果是正确的,但解法不够严谨,后面重复的覆盖掉前面的,由于题目数据限制也比较严,所以能提交通过。已更新算法