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. UVA 195 Anagram

    题意:求输入字符串的所有组合,按字典序输出! 解法:使用枚举(枚举前先找出最字符串的最小字典序)枚举时加上枚举生成条件! #include <iostream> #include < ...

  2. win10 pro eclipse maven: Cannot read lifecycle mapping metadata for artifact org.apache.maven.plugins:mav invalid END header (bad central directory offset)

    Error:Cannot read lifecycle mapping metadata for artifact org.apache.maven.plugins:mav ... invalid E ...

  3. 我为什么要再给lua写一个json模块

    最近要给自己编写的服务器加上json解析模块.根据我当前的项目,可以预测服务器中使用json的地方: 通信.由于与客户端通信使用google protocolbuffer,仅在与SDK通信中使用jso ...

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

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

  5. Jmeter数据库连接

    1.添加配置元件:测试计划右键-->配置元件-->JDBC Connection Configuration如下图: 注意:上述的Variable Name:在后续的JDBC Reques ...

  6. openfire连接登陆优化方案

    client登陆openfire,大概总共须要9个来回才完毕登录. 在2G情况下.就表现为client登录特别慢,所以,为解决问题,对openfire进行了例如以下优化 openfire的连接.登陆过 ...

  7. POJ 2175 Evacuation Plan (费用流,负环,消圈法,SPFA)

    http://poj.org/problem?id=2175 Evacuation Plan Time Limit: 1000MS   Memory Limit: 65536K Total Submi ...

  8. [React] React Router: Named Components

    In this lesson we'll learn how to render multiple component children from a single route. Define a n ...

  9. [ES6] Function Params

    1. Default Value of function param: The function displayTopicsPreview() raises an error on the very ...

  10. Adobe/Flash Media Server 5.0 linux 64位系统下的安装

    一.下载 Adobe/Flash MS5.0下载地址: http://fs1.d-h.st/download/00036/VOt/adobemediaserver_5_ls1_linux64.tar. ...