当前位置:网站首页>P1033 free fall (number theory)

P1033 free fall (number theory)

2021-08-10 08:04:51 wx6110fa547fd20

P1033 Free fall ( number theory )

  Subject portal

The question : Physics problems 0-n-1 n A small ball in one position falls freely , A long time l high k Your car from s1 Start with speed v Move at a constant speed , Ask how many balls the car can catch at most

Ideas : Find the earliest and latest ball number , Subtracting the +1 that will do . Pay attention to the accuracy of this question card to calculate i_l and i_r Subtract... Respectively 1e4 And plus 1e-4. still more i_l Can't get to the far left .

#include<bits/stdc++.h>
using namespace std;
int n;
double h,s1,v,l,k;
int main()
{
    cin>>h>>s1>>v>>l>>k>>n;
    double t_max=sqrt(h/5);
    double t_min=sqrt((h-k)/5);
    int i_r=int(s1-t_min*v+l+1e-4),i_l=(int)ceil(s1-t_max*v-1e-4);
    i_r=min(i_r,n-1);i_l=max(i_l,0);
    if(i_l>n-1) puts("0");
    else cout<<i_r-i_l+1;
}

      
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.

版权声明
本文为[wx6110fa547fd20]所创,转载请带上原文链接,感谢
https://chowdera.com/2021/08/20210810080205596p.html

随机推荐