![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ZOJ
薄层
努力就有收获~
展开
-
三分法求凸性函数极大极小值
直接贴模板,理解很容易,网上的题解一搜便是。唉,贴一个大佬吧:http://blog.csdn.net/pi9nc/article/details/9666627模板:const double eps = 1e-6;double Calc(double k){ return ...(计算表达式);}double SanFen(double l, double r){原创 2017-05-18 00:52:50 · 1104 阅读 · 0 评论 -
ZOJ-4019 18th浙江省赛F.Schrödinger's Knapsack(dp)
题意:给两个序列s1,s2,每个序列都有一个系数k1,k2,现在有一个总容量c,要求从这两个序列中取数,使得最后的价值最大。每个数放进背包之后获得的价值为(当前容量-这个数占的容量)*当前序列的系数。 思路:已知总数n和m较小,易知每个序列放入背包的顺序应该是从小到大的,所以dp[i][j]表示将s1序列的第1...i数和s2序列的第1...j数放入背包时取得的最大价值。s[i][j]原创 2018-04-30 16:28:11 · 253 阅读 · 0 评论 -
ZOJ-3987 Numbers 2017CCPC秦皇岛站G题 (二进制乱搞、贪心)
DreamGrid has a nonnegative integer . He would like to divide into nonnegative integers and minimizes their bitwise or (i.e. and should be as small as possible).InputThere are multiple test cases. The first line of input contains an integer , indica原创 2017-10-30 16:13:39 · 2363 阅读 · 1 评论 -
ZOJ-3964 2017年浙大省赛G题博弈
先记录下心情,其实在看大佬题解前,自己已经基本yy出来了,但有一两个点没处理好,就只能放弃,亟待加油啊~本题思路:特判bi为1或者为2时的情况,① 当bi = 1 && ai == 1时,此时这堆石子会被看作普通堆,因为两个人的合法操作是一样的;② 当除第一种情况之外的bi == 1 || bi == 2的堆数大于1堆时,Bob必胜,因为此时Alice的操作是受一堆以上的堆约束的,原创 2017-04-29 23:59:48 · 656 阅读 · 0 评论 -
ZOJ-1577 求素因子个数 + gcd和lcm的性质?(或者你也可以暴力?)
题意:给出两个数x,y,求有多少组p,q,满足gcd(p,q) = x 且 lcm(p,q) = y。注意:pair(p, q) 和 pair(q, p)是两种方案。思路:两个很易得的结论:lcm(x,y)/ gcd(x,y) = (x / gcd(x,y)) * (y / gcd(x,y))lcm(x,y)* gcd(x,y) = x*y假设g原创 2017-05-02 15:39:40 · 569 阅读 · 0 评论 -
ZOJ-3645 BiliBili(高斯消元)
Shirai Kuroko is a Senior One student. Almost everyone in Academy City have super powers, and Kuroko is good at using it. Her ability is "Teleporting", which can make people to transfer in the eleven dimension, and it shows like moving instantly in general原创 2017-07-10 23:51:14 · 275 阅读 · 0 评论 -
ZOJ-3732 Graph Reconstruction(判定无向图度数序列能否可图化)
Let there be a simple graph with N vertices but we just know the degree of each vertex. Is it possible to reconstruct the graph only by these information?A simple graph is an undirected graph that has no loops (edges connected at both ends to the same ver原创 2017-09-30 15:46:41 · 2446 阅读 · 0 评论 -
奇偶剪枝-优化(ZOJ 2110 , HDU 1010)
奇偶剪枝经典的实例, ZOJ 2110 , HDU 1010从1走向1的时候与0走向0的情况是一样的。s——— ——+ |+ |转载 2016-11-01 23:17:02 · 311 阅读 · 0 评论