Codeforces 435 A Queue on Bus Stop】的更多相关文章

题意:给出n队人坐车,车每次只能装载m人,并且同一队的人必须坐同一辆车,问最少需要多少辆车 自己写的时候想的是从前往后扫,看多少队的人的和小于m为同一辆车,再接着扫 不过写出来不对 后来发现把每一队的人装走之后,储存下这辆车还能装载的人数,每一次再判断 #include<iostream> #include<cstdio> #include<cstring> #include <cmath> #include<stack> #include<…
  A. Queue on Bus Stop time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output It's that time of the year when the Russians flood their countryside summer cottages (dachas) and the bus stop has a l…
Codeforces 28C Bath Queue LINK 简要题意:有 n 个人等概率随机进入 m 个房间,一个房间可以有多个人,第 i 个房间有 ai 个水龙头,在一个房间的人要去排队装水,他们会使得最长的队尽可能小,求所有房间中最长队列长度的期望 Mark一个很好的blog #include<bits/stdc++.h> using namespace std; #define N 110 #define fu(a,b,c) for(int a=b;a<=c;++a) #defi…
水题 #include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int n,m; cin >> n >> m; int cnt = 0, sum = 0; for(int i = 0 ; i < n; ++ i){ int a; cin >> a; if(sum + a > m){ cnt++; s…
地址:http://codeforces.com/contest/660/problem/B 题目: B. Seating On Bus time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Consider 2n rows of the seats in a bus. n rows of the seats on the left…
B. The Queue time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, b…
题目链接: B. Seating On Bus time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each ro…
题目链接:http://codeforces.com/problemset/problem/435/B 题目意思:给出一个最多为18位的数,可以通过对相邻两个数字进行交换,最多交换 k 次,问交换 k 次之后,这个数最大可以变成多少. 不知道最近是不是疏于训练(一直研究百度之星的题目,最终决定就是暂时放下,可能能力还没达到做那种题目的水平,不过都好感谢乌冬兄耐心甘为我解答左两道题目),昨晚又想学学拓扑排序(SPFA提到),结果没看明白= =...再加上昨晚比赛...电脑卡机卡得要命,于是悲催了=…
题意:给出一串数字,给出k次交换,每次交换只能交换相邻的两个数,问最多经过k次交换,能够得到的最大的一串数字 从第一个数字往后找k个位置,找出最大的,往前面交换 有思路,可是没有写出代码来---sad #include<iostream> #include<cstdio> #include<cstring> #include <cmath> #include<stack> #include<vector> #include<ma…
模拟. 情况有点多,需要仔细.另外感觉题目的$tf$有点不太对......而且数据水了. $0$ $5$ $2$ $2$ $0$ $5$ 这组数据按照题意的话答案可以是$2$和$4$,但是好多错的答案能$AC$. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cstring> #include<cmath> #include<a…