过不了,#2WA,求调
查看原帖
过不了,#2WA,求调
263673
CoderXL楼主2022/12/1 09:02

这代码为啥过不了

//
//  main.cpp
//  P1033
//
//  Created by administrator on 2022/12/1.
//

#include <bits/stdc++.h>
#define g 10.0
using namespace std;
double h,s,v,l,k;
double t1,t2,s1,s2;
int n,ans;
int main()
{
    cin>>h>>s>>v>>l>>k>>n;
    t1=sqrt((h-k)/5);
    t2=sqrt(h/5);
    s1=s-v*t2;
    s2=s-v*t1+l;
    if(floor(s2)>=n-1)
        s2=double(n-1);
    if(ceil(s1)<=0)
        s1=0.0;
    if(s2<s1)
    {
        cout<<0;
        return 0;
    }
    ans=ceil(s2)-floor(s1)-1+(s1-floor(s1)<=0.0001?1:0)+(ceil(s2)-s2<=0.0001?1:0);
    cout<<ans;
    return 0;
}

2022/12/1 09:02
加载中...