洛谷 P1033 自由落体 数学

洛谷 P1033 自由落体 数学 
这道题 数学题
如果 小球 到车上表面的高度 时车右端在球右边
且 小球到车下表面时高度时 车左端在求左边时 就说明 球能被车接到 
然后注意一下精度误差然后就应该行了

 1 #include <cstdio>
 2 #include <cmath>
 3 #include <cstdlib>
 4 #include <cstring>
 5 #include <string>
 6 #include <algorithm>
 7 #include <iomanip>
 8 #include <iostream>
 9 using namespace std ;
10 
11 double h,s1,v,l,k,n ;
12 int ans ;
13 
14 int main() 
15 {
16     scanf("%lf%lf%lf%lf%lf%lf",&h,&s1,&v,&l,&k,&n) ;
17     for(int i=0;i<=n-1;i++) 
18         if( i<= s1-sqrt((h-k)/5)*v+l+0.0001&& i>=s1 - sqrt(h/5)*v -0.0001 ) ++ans ;
19     printf("%d
",ans) ;     
20     
21     return 0 ;
22 }
原文地址:https://www.cnblogs.com/third2333/p/6829657.html