hdu 5144 NPY and shot】的更多相关文章

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…
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…
当时做这道题时一直想退出物理公式来,但是后来推到导数那一部分,由于数学不好,没有推出来那个关于Θ的最值,后来直接暴力了,很明显超时了,忘了三分法的应用,这道题又是典型的三分求最值,是个单峰曲线,下面是代码 #include <stdio.h> #include <math.h> #define PI 3.1415926 int v, h; double f(double i)//推倒物理公式 { *i)/9.8+(sqrt(v*v*1.0*sin(i)*sin(i)+2.0*9.8…
开始推导用公式求了好久(真的蠢),发现精度有点不够. 其实这种凸线上求点类的应该上三分法的,当作入门吧... /** @Date : 2017-09-23 21:15:57 * @FileName: HDU 5144 三分 无聊物理题.cpp * @Platform: Windows * @Author : Lweleth (SoungEarlf@gmail.com) * @Link : https://github.com/ * @Version : $Id$ */ #include <bit…
NPY and shot Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 808    Accepted Submission(s): 342 Problem Description NPY is going to have a PE test.One of the test subjects is throwing the shot.T…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5144 题目意思:有个人抛物体,已知抛的速度和高度,问可以抛到的最远距离是多少.即水平距离. 做的时候是抄公式的,居然过了,幸运幸运............ #include <iostream> #include <cstdio> #include <cmath> #include <cstring> #include <algorithm> usi…
题目连接 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 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=5145 [题目大意] 给出一个数列,每次求一个区间数字的非重排列数量.答案对1e9+7取模. [题解] 我们发现每次往里加入一个新的数字或者减去一个新的数字,前后的排列数目是可以通过乘除转移的,所以自然想到用莫队算法处理.因为答案要求取模,所以在用除法的时候要计算逆元. [代码] #include <cstdio> #include <algorithm> #include <…
http://acm.hdu.edu.cn/showproblem.php?pid=5143 题意: 给定数字1,2,3,4.的个数每个数字能且仅能使用一次,组成多个或一个等差数列(长度大于等于3),问能否成功. 思路: 可以发现等差数列只有(123,234,1234和长度>=3的常数列),如果选择非常数数列(123,234,1234)数量大于等于3, 可以变为三个或4个常数列,例如(123,123,123)变为(111,222,333).所以从0-2枚举选择非常数列的数量,再判断能否用常数列覆…
题目地址:HDU 5145 莫队真的好奇妙.. 这种复杂度竟然仅仅有n*sqrt(n)... 裸的莫队分块,先离线.然后按左端点分块,按块数作为第一关键字排序.然后按r值作为第二关键字进行排序. 都是从小到大,能够证明这种复杂度仅仅有n*sqrt(n). 然后进行块之间的转移. 代码例如以下: #include <iostream> #include <string.h> #include <math.h> #include <queue> #include…
题意: cases T(1≤T≤10) (0<n,m≤30000) (0<ai≤30000)    n个数ai 表示n个女孩所在教室 m次询问 [L,R](1 <= L <= R <= n)     问访问所有女孩的顺序方案数(进教室顺序)为多少(一次进教室只能访问一个人)    分析: 莫队算法 + 排列数 一个区间内的方案数为 C(m,c1)*C(m-c1,c2)*C(m-c1-c2,c3)*....*C(cn,cn)    每次转移通过下式: C(m+1,n+1) =…
pid=5145">[HDU 5145] NPY and girls(组合+莫队) NPY and girls Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 593    Accepted Submission(s): 179 Problem Description NPY's girlfriend blew him out!H…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5143 题目意思:给出 1, 2, 3, 4 的数量,分别为a1, a2, a3, a4,问是否在每个数只使用一次的前提下,分成若干部分,每部分数的长度 >= 3且满足是等差数列.可以的话输出 Yes ,否则 No . 比赛的时候过了pretest,那个开心啊--然后跟 XX 兽讨论了之后,才发现自己理解错了题目= = 要用到深搜,问组合嘛--组合就是有可能是(1, 2, 3, 4).(1, 2, 3…
题目 解题过程: //物理数学题 #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; int main() { double h,l,v,ans; while(scanf("%lf%lf%lf",&h,&l,&v)!=EOF) { &&l==&&v==)break; ans = h + v *…
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=5091 Problem Description Recently, the γ galaxies broke out Star Wars. Each planet is warring for resources. In the Star Wars, Planet X is under attack by other planets. Now, a large wave of enemy spaces…
A - Hero Time Limit:3000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4310 Description When playing DotA with god-like rivals and pig-like team members, you have to face an embarrassing situation: All your t…
题目大意:  一直初速度v和抛出速度h  求标枪抛出的最远距离: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5144 显然  d=v/g*sqrt(v*v+2*g*h);<此处略去推导过程>…
NPY and girls 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5145 莫队算法 注意到没有修改区间的操作,使用莫队算法:将整个区间分成若干个块,将询问区间按块优先升序排序,同块内按区间右界升序排序,添加一个元素,满足条件的值sum就变为sum=(sum*times[a[r]]/(r-l+1));减少一个值同理.从第一个区间一直推到最后一个区间即可.(之前TLE一直以为是区间大小的问题,现在发现是这句话while(x<0)x+=M,不过…
Dying Light Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 513    Accepted Submission(s): 122 Problem Description LsF is visiting a local amusement park with his friends, and a mirror room su…
HDU 3533 Escape(大逃亡) /K (Java/Others)   Problem Description - 题目描述 The students of the HEU are maneuvering for their military training. The red army and the blue army are at war today. The blue army finds that Little A is the spy of the red army, so…
Lifting the Stone Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4819    Accepted Submission(s): 2006 Problem Description There are many secret openings in the floor which are covered by a big…
链接:http://acm.hdu.edu.cn/showproblem.php?pid=5318 The Goddess Of The Moon Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 438    Accepted Submission(s): 150 Problem Description Chang'e (嫦娥) is…
Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7194    Accepted Submission(s): 3345 Problem Description 话说上回讲到海东集团面临内外交困,公司的元老也只剩下XHD夫妇二人了.显然,作为多年拼搏的商人,XHD不会坐以待毙的.  一天,当他正在苦思冥想解困良策的…
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #include<cstring> #include<algorithm> using namespace std; typedef long long ll; int jc[100003]; int p; int ipow(int x, int b) { ll t = 1, w = x;…
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格线满足两侧分别是海洋和陆地 这道题很神 首先考虑一下,什么情况下能够对答案做出贡献 就是相邻的两块不一样的时候 这样我们可以建立最小割模型,可是都说是最小割了 无法求出最大的不相同的东西 所以我们考虑转化,用总的配对数目 - 最小的相同的对数 至于最小的相同的对数怎么算呢? 我们考虑这样的构造方法:…
Special equations Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4569 Description Let f(x) = a nx n +...+ a 1x +a 0, in which a i (0 <= i <= n) are all known integers. We call f(x) 0 (mod…
The kth great number Time Limit:1000MS     Memory Limit:65768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4006 Description Xiao Ming and Xiao Bao are playing a simple Numbers game. In a round Xiao Ming can choose to write down a nu…
How many integers can you find Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1796 Description   Now you get a number N, and a M-integers set, you should find out how many integers which are sm…