http://codeforces.com/contest/369/problem/B

先对k个处理,先处理sk%k个为sk/k+1,如果sk/k==0,k个数都为sk/k;对与剩下的数也按照同样的方法处理,处理完之后就是所要求的序列。

 #include <cstdio>
#include <cstring>
#include <algorithm>
#define maxn 10000
using namespace std; int n,k,l,r,s1,s2;
int a[maxn]; int main()
{
while(scanf("%d%d%d%d%d%d",&n,&k,&l,&r,&s1,&s2)!=EOF)
{
int cnt=;
int i;
for(i=; i<=s2%k; i++)
{
a[cnt++]=s2/k+;
}
for(; i<=k; i++)
{
a[cnt++]=s2/k;
}
if(n!=k)
{
int m=n-k;
int s3=s1-s2;
for(i=; i<=s3%m; i++)
{
a[cnt++]=s3/m+;
}
for(; i<=m; i++)
{
a[cnt++]=s3/m;
}
}
for(int i=; i<n; i++)
{
printf("%d ",a[i]);
}
printf("\n");
}
return ;
}

cf B. Valera and Contest的更多相关文章

  1. CF 369 B. Valera and Contest

    http://codeforces.com/contest/369/problem/B 题意 :n, k, l, r, sall, sk,n代表的是n个人,这n个人的总分是sall,每个人的得分大于 ...

  2. CF 369C . Valera and Elections tree dfs 好题

    C. Valera and Elections   The city Valera lives in is going to hold elections to the city Parliament ...

  3. 坑爹CF April Fools Day Contest题解

    H - A + B Strikes Back A + B is often used as an example of the easiest problem possible to show som ...

  4. cf E. Valera and Queries

    http://codeforces.com/contest/369/problem/E 题意:输入n,m; n 代表有多少个线段,m代表有多少个询问点集.每一个询问输出这些点的集合所占的线段的个数. ...

  5. cf D. Valera and Fools

    http://codeforces.com/contest/369/problem/D 标号最小的两个人会有四种状态:a活b活,a死b活,a活b死,a死b死:按照这四种状态dfs就可以求出最后的数量. ...

  6. cf C. Valera and Elections

    http://codeforces.com/contest/369/problem/C 先见边,然后dfs,在回溯的过程中,如果在这个点之后有多条有问题的边,就不选这个点,如果没有而且连接这个点的边还 ...

  7. CF 441E Valera and Number

    CF 441E Description 一共执行\(k\)次,每次有\(p\%\)把\(x * 2\),有\((100 - p)\%\)把\(x + 1\).问二进制下\(x\)末尾期望\(0\)的个 ...

  8. CF A.Mishka and Contest【双指针/模拟】

    [链接]:CF/4892 [题意]: 一个人解决n个问题,这个问题的值比k小, 每次只能解决最左边的或者最右边的问题 解决了就消失了.问这个人能解决多少个问题. [代码]: #include<b ...

  9. Codeforces Round #216 (Div. 2) B. Valera and Contest

    #include <iostream> #include <algorithm> #include <vector> using namespace std; in ...

随机推荐

  1. Mysql 存储过程和函数区别

    存储过程是procedure用户定义的一系列sql语句的集合,涉及特定表或其它对象的任务,用户可以调用存储过程,而函数通常是数据库已定义的方法,它接收参数并返回某种类型的值并且不涉及特定用户表. 存储 ...

  2. uboot之board.c源码分析

    /lib_arm/board.c 主要完成了一些初始化的操作,最重要的是有start_armboot函数 _armboot_start地址为多少?? /* * * U-Boot code: 00F00 ...

  3. BZOJ 3153 Sone1

    题解:水水哒AAA树啦 #include<iostream> #include<cstdio> #include<cmath> #include<algori ...

  4. JAVA并发2

    Java 5中引入了新的锁机制--java.util.concurrent.locks中的显式的互斥锁:Lock接口,它提供了比synchronized更加广泛的锁定操作.Lock接口有3个实现它的类 ...

  5. bzoj2244[SDOI2011]拦截导弹

    http://www.lydsy.com/JudgeOnline/problem.php?id=2244 第$i$个导弹看成一个三元组$(i,h_i,v_i)$ 其实就是最长上升子序列的问题. 我们分 ...

  6. 我学hash_map(2)

    啊,转眼之间就来到了我学hash_map(2)了.我们也从hash_map转移到了unordered_map上来了,今天这个文章的目的就是要来分享一下使用这个hash_map,哦不,unordered ...

  7. ios 数组倒序和数组转字符串

    NSMutableArray *array = [NSMutableArray arrayWithObjects:",nil]; NSArray* reversedArray = [[arr ...

  8. C++编程规范之17:避免使用“魔数”

    摘要: 程序设计并非魔术,所以不要故弄玄虚,要避免在代码中使用诸如42和3.1415926这样的文字常量.它们本身没有提供任何说明,并且因为增加了难于检测的重复而使维护更加复杂.可以用符号名称和表达式 ...

  9. mvc之验证IEnumerable<T> 类型

    假设我们有这么一种需求,我们要同时添加年级和年级下面的多个班级,我们一般会像下面这种做法. Action中我们这样接收: [HttpPost] public ActionResult CreateGr ...

  10. [ES6] Objects vs Maps

    Map is really useful when you want to use object as a key to set vaule, in ES5, you cannot really us ...