FFT
青烟绕指柔!
我不怕千万人阻挡,只怕自己投降。
展开
-
[AH2017/HNOI2017]礼物 FFT做卷积
设增加的值为x,带入式子化简可得: 如果我们枚举x,那么整个式子只有最后一项是未知的。令整个式子最小,所以最后一项最大,所以我们需要求最后一项的最大值。 如果我们把b反转一下,那么最后一项就是卷积的形式了,所以直接FFT求出。 因为是成环的,所以我们把a复制一下,放到后面,然后FFT之后,n+1 -> 2*n 的每一项都代表选择之后的值,取最大值即可。 AC代码: #pragma ...原创 2020-01-18 14:31:05 · 277 阅读 · 0 评论 -
A+B Problem 生成函数+FFT
题目链接:A+B Problem Given N integers in the range [−50000,50000], how many ways are there to pick three integers ai, aj, ak, such that i, j, k are pairwise distinct and ai+aj=ak? Two ways are different i...原创 2020-01-17 14:10:12 · 308 阅读 · 0 评论 -
HDU - 4609 生成函数+FFT
3-idiots Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 10462 Accepted Submission(s): 3554 Problem Description King OMeGa catched three me...原创 2020-01-17 11:09:34 · 1614 阅读 · 1 评论 -
[ZJOI2014]力 - FFT做卷积
Description 给出n个数qi,给出Fj的定义如下: 令Ei=Fi/qi,求Ei. Input 第一行一个整数n。 接下来n行每行输入一个数,第i行表示qi。 n≤100000,0<qi<1000000000 Output n行,第i行输出Ei。与标准答案误差不超过1e-2即可。 Sample Input 5 4006373.885184 15375036.435759 17...原创 2020-01-16 23:06:04 · 242 阅读 · 0 评论