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. PL/SQL 包头和包体

    包用于逻辑组合相关的过程和函数,它由包规范和包体两部分组成,包规范用于定义公用的常量 变量,过程和函数,在SQL*PLUS中建立包规范可以使用CREATE PACKAGE命令. 实例如下: CREAT ...

  2. BZOJ1651: [Usaco2006 Feb]Stall Reservations 专用牛棚

    1651: [Usaco2006 Feb]Stall Reservations 专用牛棚 Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 509  Sol ...

  3. HDU_2027——统计元音

    Problem Description 统计每个元音字母在字符串中出现的次数.   Input 输入数据首先包括一个整数n,表示测试实例的个数,然后是n行长度不超过100的字符串.   Output ...

  4. red-hat6.5 yum 源配置,cloud-init 安装 This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register

    This system is not registered to Red Hat Subscription Management. You can use subscription-manager t ...

  5. 手势触摸定位(UIPanGestureRecognizer)

    /** 1.相对于父坐标系而言,表示当前触摸点所在的位置 */ CGPoint locationPoint = [panGestureRecognizer locationInView:panGest ...

  6. [ES6] for..in && for..of

    var ary = [ { id: 1, name: "Zhentian" }, { id: 2, name: "Alice" } ]; for..in Pri ...

  7. Swift中实现点击、双击、捏、旋转、拖动、划动、长按手势的类和方法介绍

    1.UITapGestureRecognizer 点击/双击手势 代码如下: var tapGesture = UITapGestureRecognizer(target: self, action: ...

  8. 搭建Windows下Java Web开发环境

      概要 1.SSH开发相关软件及开发包下载2.软件安装及相关设置3.最简单的Web程序 1.软件下载 在D盘建一个目录JavaTools,用来存放下载的软件和开发包.(本教程将使用D盘,你也可以使用 ...

  9. c#中从string数组转换到int数组

    以前一直有一个数组之间转换的东西,可是忘记了,今天也是找了好久也没有解决,最后用这种方法解决了,分享给大家. " }; int[] output = Array.ConvertAll< ...

  10. 解决Android单个dex文件不能超过65536个方法问题

    当我们的项目代码过大时,编译运行时会报Unable to execute dex: method ID not in[0, 0xffff]: 65536)错误.当出现这个错误时说明你本身自己的工程代码 ...