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. USBSpirit(USB精灵)更新到1.2.300.105

    USBSpirit(USB精灵)是CopyU!的内核引擎,CopyU!的主要功能均由该引擎提供,此次更新主要内容如下:(版本号:1.2.300.105) 1.[修复]:修复了几处引擎的资源泄露问题,提 ...

  2. css属性之box-shadow

    box-shadow 属性向框添加一个或多个阴影. <!DOCTYPE html> <html> <head> <style> div { width: ...

  3. 【转】Linux 中断学习之小试牛刀篇

    原文网址:http://www.linuxidc.com/Linux/2011-02/32129.htm 前言 在前面分析了中断的基本原理后,就可以写一个内核中断程序来体验以下,也可以借此程序继续深入 ...

  4. NERDTree这个插件的用法简介

    事情是这样子的,想做做李治军老师班的操作系统实验,但是Linux上的gedit太简陋了(这个简陋程度堪比Windows环境下的"记事本"),被杨世祺大神嘲笑了.我心想既然在linu ...

  5. poj2114 Boatherds

    Description Boatherds Inc. is a sailing company operating in the country of Trabantustan and offerin ...

  6. sicily 4433 DAG?

    题意:输入一个有向图,判断该图是否是有向无环图(Directed Acyclic Graph). 解法:还是深搜 #include<iostream> #include<memory ...

  7. C++图结构的图结构操作示例

    示例代码: /* By qianshou 2013/10/5明天就要开学了~哎~ */ #include<iostream> using namespace std; /********* ...

  8. MySQL日期函数

    1.已知出生日期,求年龄 SELECT '1992-04-10' as birthday, curdate(), ( YEAR (curdate()) - YEAR ('1992-04-10')-1 ...

  9. final(最终、修饰符)

    /* final(最终.修饰符) final关键字的用法: 1. final关键字修饰一个基本类型的变量时,该变量不能重新赋值,第一次的值为最终的. 2. fianl关键字修饰一个引用类型变量时,该变 ...

  10. TravelCMS旅游网站系统前台诞生记-2(后台框架篇)

    经过一个多月的研发,前台页面已基本成型了,已开发了线路和签证两大模块,支持在线支付,微信支付待开发,在这个过程中,发现前端技术远比后台技术注重的细节多,特别是css,比我想象的要难,为了兼容各种浏览器 ...