hdu 5142 NPY and FFT】的更多相关文章

题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5142 NPY and FFT Description A boy named NPY is learning FFT algorithm now.In that algorithm,he needs to do an operation called "reverse".For example,if the given number is 10.Its binary representai…
NPY and FFT Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 799    Accepted Submission(s): 492 Problem Description A boy named NPY is learning FFT algorithm now.In that algorithm,he needs to do…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4609 题意:给出n个正整数(数组A).每次随机选出三个数.问这三个数能组成三角形的概率为多大? 思路:求出有多少种选择的方案,除以总选择方案即可.用num[i]表示长度为i的出现几次. 对于样例1 3 3 4,我们得到num={0,1,0,2,1}, 对num求卷积,得到:num={0,0,1,0,4,2,4,4,1}.此时的num[i]表示选择两个数和为i的选择方案的种数. 但是这里有重复的: (…
NPY and shot Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1035    Accepted Submission(s): 428   Problem Description NPY is going to have a PE test.One of the test subjects is throwing the sh…
NPY and shot Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description NPY is going to have a PE test.One of the test subjects is throwing the shot.The height of NPY is H meters.He can throw the shot at t…
NPY and girls Problem Description NPY's girlfriend blew him out!His honey doesn't love him any more!However, he has so many girlfriend candidates.Because there are too many girls and for the convenience of management, NPY numbered the girls from 1 to…
http://acm.hdu.edu.cn/showproblem.php?pid=5144 题意:给你初始的高度和速度,然后让你求出水平的最远距离. 思路:三分枚举角度,然后根据公式求出水平距离. #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; const double pi=acos(-1.0); ; const…
题目链接 dp[n] = sigma(a[i]*dp[n-i]), 给出a1.....an, 求dp[n]. n为1e5. 这个式子的形式显然是一个卷积, 所以可以用fft来优化一下, 但是这样也是会超时的. 所以可以用cdq分治来优化. cdq分治就是处理(l, mid)的时候, 将dp[l]...dp[mid]对dp[mid+1]...dp[r]做的贡献都算出来. #include <bits/stdc++.h> using namespace std; #define pb(x) pus…
[题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=5145 [题目大意] 给出一个数列,每次求一个区间数字的非重排列数量.答案对1e9+7取模. [题解] 我们发现每次往里加入一个新的数字或者减去一个新的数字,前后的排列数目是可以通过乘除转移的,所以自然想到用莫队算法处理.因为答案要求取模,所以在用除法的时候要计算逆元. [代码] #include <cstdio> #include <algorithm> #include <…
题意:给定 n 条边,问随机选出 3 条边,能组成三角形的概率是多少. 析:答案很明显就是  能组成三角形的种数 / (C(n, 3)).现在的问题是怎么求能组成三角形的种数. 这个博客说的非常清楚了... https://www.cnblogs.com/kuangbin/archive/2013/07/24/3210565.html 总体来说就是把边长转换成下标,然后再根据组合数,就可以知道选出两条边,长度为 i 有多少种情况,然后再减去重复的,最后再枚举斜边,就可以解决这个问题了. 代码如下…