摘要: #include using namespace std; #define maxn 510 const double eps=1E-8; int sig(double d){ return(d>eps)-(d0) pp[m++]=p[i]; if(sig(cross(a,b,p[i]))!=sig(cross(a,b,p[i+1]))) ... 阅读全文
posted @ 2019-04-19 10:14 真想不出名字了 阅读(837) 评论(0) 推荐(0) 编辑
摘要: 算法背景: 有N堆石子排成一排,每堆石子有一定的数量。现要将N堆石子合并为1堆。在合并的过程中只能每次将相邻的两堆石子合并,每次合并的花费为这两堆石子之和,求合并成1堆的最小花费。 dp[i][j]表示将区间[i, j]合并成1堆的最小代价。 阅读全文
posted @ 2018-11-16 16:29 真想不出名字了 阅读(139) 评论(0) 推荐(0) 编辑
摘要: In Chinese mythology, Pangu is the first living being and the creator of the sky and the earth. He woke up from an egg and split the egg into two part 阅读全文
posted @ 2018-11-15 11:23 真想不出名字了 阅读(362) 评论(0) 推荐(0) 编辑
摘要: Description In country Light Tower, a presidential election is going on. There are two candidates, Mr. X1 and Mr. X2, and both of them are not like go 阅读全文
posted @ 2018-11-03 10:33 真想不出名字了 阅读(371) 评论(1) 推荐(1) 编辑
摘要: Problem Description The sky was brushed clean by the wind and the stars were cold in a black sky. What a wonderful night. You observed that, sometimes 阅读全文
posted @ 2018-10-29 21:12 真想不出名字了 阅读(243) 评论(0) 推荐(0) 编辑
摘要: Problem Description Coach Pang is interested in Fibonacci numbers while Uncle Yang wants him to do some research on Spanning Tree. So Coach Pang decid 阅读全文
posted @ 2018-10-29 17:34 真想不出名字了 阅读(299) 评论(0) 推荐(0) 编辑
摘要: Hello everyone! I am your old friend Rikka. Welcome to Xuzhou. This is the first problem, which is a problem about the minimum spanning tree (MST). I 阅读全文
posted @ 2018-10-29 16:35 真想不出名字了 阅读(1147) 评论(0) 推荐(0) 编辑
摘要: 描述 2007年到来了。经过2006年一年的修炼,数学神童zouyu终于把0到100000000的Fibonacci数列(f[0]=0,f[1]=1;f[i] = f[i-1]+f[i-2](i>=2))的值全部给背了下来。接下来,CodeStar决定要考考他,于是每问他一个数字,他就要把答案说出来 阅读全文
posted @ 2018-10-24 21:54 真想不出名字了 阅读(267) 评论(0) 推荐(0) 编辑
摘要: Little Tommy is playing a game. The game is played on a 2D N x N grid. There is an integer in each cell of the grid. The rows and columns are numbered 阅读全文
posted @ 2018-10-18 15:20 真想不出名字了 阅读(214) 评论(0) 推荐(0) 编辑
摘要: Description You are given a sequence of n integers a1 , a2 , ... , an in non-decreasing order. In addition to that, you are given several queries cons 阅读全文
posted @ 2018-10-17 22:42 真想不出名字了 阅读(209) 评论(0) 推荐(0) 编辑
摘要: Problem Description Paul draw a big m*n matrix A last month, whose entries Ai,j are all integer numbers ( 1 <= i <= m, 1 <= j <= n ). Now he selects s 阅读全文
posted @ 2018-10-17 21:39 真想不出名字了 阅读(257) 评论(0) 推荐(0) 编辑
摘要: (1) n是指要找该数列的第n项。 (2) 往vec中放入该数列前几项的值,越多越精确。 阅读全文
posted @ 2018-10-17 12:28 真想不出名字了 阅读(324) 评论(0) 推荐(0) 编辑
摘要: ①一维RMQ (1) dp[i,j] 表示从第i个数起连续2j个数中的(最大值min、最小值max、最大公约数gcd……),通过更改下列代码中的红色函数即可实现。 (2) b数组放置所需查询的数列。 ②二维RMQ 给定一个n*m矩阵,每次询问左上角(r1,c1)到右下角(r2,c2)的子矩形中的(最 阅读全文
posted @ 2018-10-17 09:52 真想不出名字了 阅读(254) 评论(0) 推荐(0) 编辑
摘要: Problem Description Give you a sequence of N(N≤100,000) integers : a1,...,an(0<ai≤1000,000,000). There are Q(Q≤100,000) queries. For each query l,r yo 阅读全文
posted @ 2018-10-16 23:04 真想不出名字了 阅读(145) 评论(0) 推荐(1) 编辑
摘要: Problem Description 很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input 本题目包含多组测试,请 阅读全文
posted @ 2018-10-16 17:50 真想不出名字了 阅读(349) 评论(0) 推荐(1) 编辑