B. Valera and Contest

原创 2013年12月02日 21:12:26

time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Valera loves to participate in competitions. Especially in programming contests. Today he has participated in the contest with his team, consisting of n students (including Valera). This contest was an individual competition, so each student in the team solved problems individually.

After the contest was over, Valera was interested in results. He found out that:

  • each student in the team scored at least l points and at most r points;
  • in total, all members of the team scored exactly sall points;
  • the total score of the k members of the team who scored the most points is equal to exactly sk; more formally, ifa1, a2, ..., an is the sequence of points earned by the team of students in the non-increasing order (a1 ≥ a2 ≥ ... ≥ an), then sk = a1 + a2 + ... + ak.

However, Valera did not find out exactly how many points each of n students scored. Valera asked you to recover any distribution of scores between the students of the team, such that all the conditions above are met.

Input

The first line of the input contains exactly six integers n, k, l, r, sall, sk (1 ≤ n, k, l, r ≤ 1000l ≤ rk ≤ n1 ≤ sk ≤ sall ≤ 106).

It's guaranteed that the input is such that the answer exists.

Output

Print exactly n integers a1, a2, ..., an — the number of points each student scored. If there are multiple solutions, you can print any of them. You can print the distribution of points in any order.

Sample test(s)
input
5 3 1 3 13 9
output
2 3 2 3 3 
input
5 3 1 3 15 9
output
3 3 3 3 3 

解题说明:模拟题,看懂题意即可


#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;

int main()
{
	int n,k,r,l,sa,sk,i;
	scanf("%d%d%d%d%d%d",&n,&k,&l,&r,&sa,&sk);
	int x=sk/k;
	int y=sk%k;
	for(i=0;i<y;i++)
	{
		printf("%d ",x+1);
	}
	for(i=0;i<k-y;i++)
	{
		printf("%d ",x);
	}
	if(n-k!=0)
	{
		 x=(sa-sk)/(n-k);
		 y=(sa-sk)%(n-k);
		for(i=0;i<y;i++)
		{
			printf("%d ",x+1);
		}
		for(i=0;i<n-k-y;i++)
		{
			printf("%d ",x);
		}
	}
	printf("\n");
	return 0;
}


相关文章推荐

C - Valera and Contest题解

c++基础题,每天刷一点,才有希望变成大神,加油

CF———— Valera and Contest

Valera loves to participate in competitions. Especially in programming contests. Today he has partic...

Codeforces Round #252 (Div. 2) B. Valera and Fruits(模拟)

B. Valera and Fruits time limit per test 1 second memory limit per test 256 megabytes ...

codeforces-441B-Valera and Fruits【暴力】

codeforces-441B-Valera and Fruits

CodeForces 441B Valera and Fruits

链接:http://codeforces.com/problemset/problem/441/B Valera and Fruits time limit per test:1 se...

Codeforces Round #252(Div. 2) 441B. Valera and Fruits 贪心

B. Valera and Fruits time limit per test 1 second memory limit per test 256 megabytes ...

Kids and Prizes 来源: <http://acm.hust.edu.cn/vjudge/contest/view.action?cid=85996#problem/B>

B - Kids and Prizes Time Limit:250MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u ...

【2015-2016 ACM-ICPC, NEERC, Northern Subregional Contest B】【构造】Black and White 构造棋盘使得两种棋子联通块数恰为x与y

#include #include #include #include #include #include #include #include #include #include #include #...

contest: Codeforces Round #297 (Div. 2), problem: (B) Pasha and String

contest: Codeforces Round #297 (Div. 2), problem: (B) Pasha and String Pasha got a very beautiful st...

CodeForces 369C. Valera and Elections

C. Valera and Elections time limit per test 1 second memory limit per test 256 megabytes...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:B. Valera and Contest
举报原因:
原因补充:

(最多只允许输入30个字)