Codeforces Round #216 (Div. 2) B. Valera and Contest
#include <iostream>
#include <algorithm>
#include <vector> using namespace std; int main(){
int n,k,l,r,s_n,s_k;
cin >> n >> k >> l >> r >> s_n >> s_k;
int s_n_k = s_n-s_k;
int average_k = s_k/k,left_k = s_k%k;
vector<int> a(n,);
for(int i = ; i < k ; ++ i ){
a[i] = average_k;
if(i < left_k) a[i]+=;
}
if(s_n_k){ //注意n和k相等的情况
int average_n_k = s_n_k / (n-k), left_n_k = s_n_k%(n-k);
for(int i = k ; i < n; ++ i){
a[i] = average_n_k;
if(i - k < left_n_k) a[i] +=;
}
}
cout<<a[];
for(int i = ; i < n ; ++ i) cout<<" "<<a[i];
cout<<endl;
return ;
}
Codeforces Round #216 (Div. 2) B. Valera and Contest的更多相关文章
- Codeforces Round #216 (Div. 2) D. Valera and Fools
题目链接:http://codeforces.com/contest/369/problem/D 注意题意:所有fools都向编号最小的fool开枪:但每个fool都不会笨到想自己开枪,所以编号最小的 ...
- Codeforces Round #216 (Div. 2)A. Valera and Plates
#include <iostream> using namespace std; int main(){ int n, m , k; cin >> n >> m & ...
- Codeforces Round #216 (Div. 2) E. Valera and Queries 树状数组 离线处理
题意:n个线段[Li, Ri], m次询问, 每次询问由cnt个点组成,输出包含cnt个点中任意一个点的线段的总数. 由于是无修改的,所以我们首先应该往离线上想, 不过我是没想出来. 首先反着做,先求 ...
- Codeforces Round #216 (Div. 2) E. Valera and Queries (BIT)
标题效果: 给很多分布 x 行轴. 然后给出了一个非常的多点集,问该组点分布多少不同段. IDEAS: 分散成多个线段点集的. 给出的线段的话,也就是说这个点集上不会有点在这条线段上. 所以我们就是求 ...
- 水题 Codeforces Round #307 (Div. 2) A. GukiZ and Contest
题目传送门 /* 水题:开个结构体,rk记录排名,相同的值有相同的排名 */ #include <cstdio> #include <cstring> #include < ...
- Codeforces Round #216 (Div. 2)
以后争取补题不看别人代码,只看思路,今天就是只看思路补完的题,有点小激动. A. Valera and Plates 水题,贪心地先放完第一种食物,在考虑第二种. 居然被卡了一会,心态要蹦 :(: # ...
- 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 input standard ...
- Codeforces Round #216 (Div. 2)解题报告
又范低级错误! 只做了两题!一道还被HACK了,囧! A:看了很久!应该是到语文题: 代码:#include<iostream> #include<]; ,m2=; ;i ...
- [Codeforces Round #237 (Div. 2)] A. Valera and X
A. Valera and X time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...
随机推荐
- poj 2236:Wireless Network(并查集,提高题)
Wireless Network Time Limit: 10000MS Memory Limit: 65536K Total Submissions: 16065 Accepted: 677 ...
- ArcGIS ElementLayer上放置Windows控件
ElementLayer是ArcGIS API for Silverlight/WPF中的一种图层类型,主要用来承载Silverlight/WPF中的UIElement对象(UIElement),使用 ...
- HDU1899 Sum the K-th's(树状数组)
枚举,每次增加点,删除点 #include<cstdio> #include<iostream> #include<cstdlib> #include<cst ...
- 不定义JQuery插件,不要说会JQuery 分类: JavaScript 2014-11-24 14:18 155人阅读 评论(0) 收藏
一:导言 有些WEB开发者,会引用一个JQuery类库,然后在网页上写一写$("#"),$("."),写了几年就对别人说非常熟悉JQuery.我曾经也是这样的人 ...
- PHP商品秒杀计时实现(解决大流量方案)
PHP商品秒杀功能我们多半以整点或时间点为例子,这样对于php来说处理不复杂,但有一个问题就是如果流量大要如何来处理,下面我们一起来看看解决办法. 要求要有小时分钟秒的实时倒计时的显示,用户端修改日期 ...
- phpMailer在thinkPHP框架中邮件发送
资源下载地址:http://pan.baidu.com/s/1c0kAoeO 提取码:ry5v 关键代码:application/Common/Common/funciton.php <?php ...
- Sonar规则学习笔记
1. A catch statement should never catch throwable since it includes errors. 在catch里永远不要抛出throwable. ...
- VS2013安装oepncv2.4.10 以及opencv 3.0.0
Author:Maddock Date:2014.12.27 …………………………………………………………………………………………………… PS: VS2013 + OPENCV 3.0.0 的安装, ...
- Vue入门笔记#过渡
Vue过渡,可以在元素从DOM中移除,插入时自动调用过渡效果.根据设定,会适时的触发过渡效果. 在使用的目标标签里添加 transition: <div transition="my_ ...
- 数据分析(4):Scipy
科学计算 最小二乘leastsq # -*- coding: utf-8 -*- def func(x,p): # p 参数列表 A,k,theta = p; # 可以一一对应赋值 return A* ...