题意:给你一个函数和一些系数,给你一堆询问,求函数值. 根据s的符号,分成两组讨论,函数值与比x小的系数数量有关,二分输出答案. #include<cstdio> #include<algorithm> using namespace std; +; int A[maxn]; int B[maxn]; int sz1,sz2; int main() { // freopen("in.txt","r",stdin); int n; scanf(…
//大概就是没想起来怎么做 解法:首先观察seitan方程,发现我们要找的是满足seitan(si*x-ai)=1的方程数,即si*x-ai>=0的方程数,因为si=1 or -1,于是分类讨论,当si=1时相当于给定每个x求满足ai<=x的ai数,当si=-1时相当于给定每个x求ai<=-1的方程数,于是我们把si=1和si=-1时的系数ai分别用两个数组记录下来,然后排序,用upper_bound分别求出两种情况下的解,加起来就是答案 #include<cstdio> #…
M. Heaviside Function Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/problem/M Description Heaviside function is defined as the piecewise constant function whose value is zero for negative argument and one for non-negat…
CF Gym 102028G Shortest Paths on Random Forests 抄题解×1 蒯板子真jir舒服. 构造生成函数,\(F(n)\)表示\(n\)个点的森林数量(本题都用EGF).怎么求呢 \(f(n)=n^{n-2}\)表示\(n\)个点的树数量,根据\(\exp\)定义,\(e^x=\sum_{i=0}^{\infty}\frac{x^i}{i!}\).那么\(F=\exp f\),感性理解就是如果选\(i\)个联通块拼起来就除以\(i!\),很对的样子. 那么期…
Time Limit: 7000/3500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 2229    Accepted Submission(s): 252 Problem Description The shorter, the simpler. With this problem, you should be convinced of this truth.    Y…
http://codeforces.com/gym/101028/problem/I 题意:给你n个洞,k个布条,问布条能贴到所有洞时的最小值. 题解:二分答案,因为答案越大就越容易满足条件. 技巧:两种judge写法:常规与upper_bound,嗯,就是有种可以upper_bound的感觉. 坑:VS提示upper_bound出错但是代码能ac Orz//_DEBUG_ERROR2("invalid iterator range", _File, _Line);百度不到为啥..最后…
传送门 A. Ariel time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output King Triton really likes watching sport competitions on TV. But much more Triton likes watching live competitions. So Triton de…
A - Luggage DistributionTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87493#problem/A Description All provident tourists know about low-cost airlines. Those who used them at least once also know th…
J - Sockets Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Valera has only one electrical socket in his flat. He also has m devices which require electricity to work. He's got n plug multipliers to plug the devices, the…
三个地点构成一个三角形. 判断一下两个人能否一起到shop然后回家,如果不能: 两个人一定在三角形内部某一点分开,假设沿着直线走,可以将问题简化. 三分从电影院出来时候的角度,在对应的直线上二分出一个分离点即可. 三分角度的方法:在shop和home两个点之间找一个点p,链接p和电影院,在这个线段上面二分出分离点. 注意:精度. #include <cstdio> #include <cstring> #include <cmath> #include <algo…