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 ...
随机推荐
- mysql TIME_WAIT
http://www.th7.cn/system/lin/201404/53762.shtml http://kerry.blog.51cto.com/172631/105233/ http://ww ...
- Delphi的面向对象编程基础笔记
1.面向对象.一门面向对象的编程语言至少要实现以下三个OOP的概念 封装:把相关的数据和代码结合在一起,并隐藏细节.封装的好处是利用程序的模块化,并把代码和其他代码分开 继承:是指一个新的类能够从父类 ...
- Oracle性能优化
(1) 选择最有效率的表名顺序(只在基于规则的优化器中有效): ORACLE的解析器按照 从右到左的顺序处理FROM子句中的表名,FROM子句中写在最后的表(基础表 driving table)将被最 ...
- 7-11使用UNION合并查询
合并查询的语法: SELECT ...FROM 表名一 UNION SELECT ...FROM 表名二 合并查询的特点: 1: 合并表中的列的个数,数据类型数据类型相同或兼容. 2:UNION 默 ...
- A Study of WebRTC Security
转自:http://webrtc-security.github.io/ A Study of WebRTC Security Abstract Web Real-Time Communication ...
- Intellij Idea 使用
一.使用前需要修改的配置: 1.当类实现Serializable接口时,自动生成 serialVersionUID 1)Setting->Inspections->java->Ser ...
- java-xml格式化
参考:http://www.oschina.net/code/snippet_17793_4733 package com.ddatsh; import java.io.IOException; ...
- 接口API测试和返回值JSON解析的插件
火狐插件1. HttpRequest作用:接口API测试例子:http://192.168.10.61:8080/ZHCS/user/loginApp.do?phone=admin&pwd ...
- markdown使用总结
# markdown简介> Markdown 是一种轻量级标记语言,它允许人们使用易读易写的纯文本格式编写文档,然后转换成格式丰富的HTML页面. —— [维基百科]( https://zh.w ...
- 64位ubuntu下重新编译hadoop2.2流水账
hadoop官方网站中只提供了32位的hadoop-2.2.0.tar.gz,如果要在64位ubuntu下部署hadoop-2.2.0,就需要重新编译源码包,生成64位的部署包.建议以下操作使用roo ...