HDU2529

水~

但是如果不找出公式的话,而用for(角度),这样会TLE。。。。

View Code
 1 #include<stdio.h>
 2 #include<math.h>
 3 #include<algorithm>
 4 using namespace std;
 5 const double pi=3.141592653;
 6 int main(){
 7     double x,y,v;
 8     while( scanf("%lf%lf%lf",&x,&y,&v)==3,x+y+v ){
 9         double ans=0;
10         /*
11         double a,b,c;
12         a=(-9.8*y*y/2.0/v/v);
13         b=y;
14         c=a;
15         ans=c-b*b/4.0/a;
16         */
17         ans=0.5*v*v/9.8-9.8*y*y*0.5/v/v;
18         printf("%.2lf\n",ans+x);
19     }
20     return 0;
21 }

h=v*t*sin(i)-0.5*g*t*t  //1

l=v*t*cos(i) //2

keep moving...
原文地址:https://www.cnblogs.com/xxx0624/p/2910851.html