1 条题解

  • 0
    @ 2021-6-14 23:29:27

    C++ :

    /*
    题目大意:
    思路:
    */
    #include<map>
    #include<set>
    #include<stack>
    #include<queue>
    #include<cmath>
    #include<string>
    #include<cstdio>
    #include <vector>
    #include<cstring>
    #include<sstream>
    #include<cstdlib>
    #include<iostream>
    #include<algorithm>
    using namespace std;
    #define ll long long
    #define ul unsigned long long
    #define inf 0x3f3f3f
    #define esp 1e-8
    #define pp printf("\n");
    #define pn(a) printf("%d\n",a);
    #define bug printf("mmp\n");
    #define mm(a,b) memset(a,b,sizeof(a))
    #define T() int test,q=1;scanf("%d",&test); while(test--)
    const int maxn=2e6+10;
    const double pi=acos(-1.0);
    const int N=1001;
    const int mod=1e9+7;
    int main()
    {
        double H,s1,v,l,k;
        int n;
        while(scanf("%lf%lf%lf%lf%lf%d",&H,&s1,&v,&l,&k,&n)!=EOF)
        {
            double tmax=sqrt(H/5);
            double tmin=sqrt((H-k)/5);
            int cnt=0;
            double x1=s1-v*tmax;
            double x2=s1-v*tmin+l;
            for(int i=0; i<n; i++)
            {
                if(i>=x1-0.00001&&i<=x2+0.00001)
                    cnt++;
            }
            printf("%d\n",cnt);
        }
        return 0;
    }
    
    

    Pascal :

    var  
     h,h1,s1,v,l,k,t:real;  
     n,i,ans:longint;  
    begin  
    readln(h,s1,v,l,k,n);  
     ans:=0;  
    for i:=0 to n-1 do  
     begin  
      if i>s1 then break;  
      t:=(s1-i)/v;  
      h1:=5*sqr(t);  
     if h1>h+0.00001 then continue;  
      t:=(s1-i+l+0.0001)/v;  
      h1:=5*sqr(t);  
      if h1<h-k-0.00001 then continue;  
      inc(ans);  
     end;  
     writeln(ans);  
    end. 
    
    • 1

    信息

    ID
    220
    时间
    1000ms
    内存
    125MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者