cf B. Valera and Contest】的更多相关文章

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; i…
http://codeforces.com/contest/369/problem/B 题意 :n, k, l, r, sall, sk,n代表的是n个人,这n个人的总分是sall,每个人的得分大于 l 小于 r ,其中k个人的分数构成了非递增序列,他们的分数总共为sk,让你求出每个人的分数输出即可,只要输出满足要求的一种即可. 思路 :这个题我是比赛完了才做的,据说很多人当时做的时候就因为错在没有特判0上,还有我做的时候越界了,因为没有考虑到如果k=n的话,n-k=0,这样的话sall%n就不…
C. Valera and Elections   The city Valera lives in is going to hold elections to the city Parliament. The city has n districts and n - 1 bidirectional roads. We know that from any district there is a path along the roads to any other district. Let's…
H - A + B Strikes Back A + B is often used as an example of the easiest problem possible to show some contest platform. However, some scientists have observed that sometimes this problem is not so easy to get accepted. Want to try? Input The input co…
http://codeforces.com/contest/369/problem/E 题意:输入n,m; n 代表有多少个线段,m代表有多少个询问点集.每一个询问输出这些点的集合所占的线段的个数. 思路:求出没有被点的覆盖的线段的个数,n-这个个数就是所求的. #include <cstdio> #include <cstring> #include <algorithm> #define maxn 2000000 using namespace std; ; int…
http://codeforces.com/contest/369/problem/D 标号最小的两个人会有四种状态:a活b活,a死b活,a活b死,a死b死:按照这四种状态dfs就可以求出最后的数量. #include <cstdio> #include <cstring> #include <algorithm> #define maxn 5000 using namespace std; int n,k; int ans; int p[maxn]; bool vis…
http://codeforces.com/contest/369/problem/C 先见边,然后dfs,在回溯的过程中,如果在这个点之后有多条有问题的边,就不选这个点,如果没有而且连接这个点的边还是有问题的边,这个点就是所求的点. #include <cstdio> #include <cstring> #include <algorithm> #define maxn 200000 using namespace std; int head[maxn],e,cnt…
CF 441E Description 一共执行\(k\)次,每次有\(p\%\)把\(x * 2\),有\((100 - p)\%\)把\(x + 1\).问二进制下\(x\)末尾期望\(0\)的个数. Solution 设\(f[i][j]\)为执行第\(i\)次后\(x + j\)末尾期望\(0\)的个数 加一:$f[i + 1][j - 1] = f[i + 1][j - 1] + (100 - p)% * f[i][j]; $ 乘二:\(f[i + 1][j * 2] = f[i +…
[链接]:CF/4892 [题意]: 一个人解决n个问题,这个问题的值比k小, 每次只能解决最左边的或者最右边的问题 解决了就消失了.问这个人能解决多少个问题. [代码]: #include<bits/stdc++.h> #define PI acos(-1.0) #define pb push_back #define F first #define S second #define debug puts #define setp cout << fixed << s…
#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…