为什么80pts

P1542 包裹快递

是精度的问题吗
by ZeroF @ 2023-02-12 09:46:48


@[0x0F](/user/385165) ``` #include<bits/stdc++.h> #define double long double using namespace std; int l[200010],r[200010],s[200010],n; bool cal(double sp){ double sum=0; for(int i=1;i<=n;i++){ sum+=1.0*s[i]/sp; if(sum>r[i])return false; if(sum<l[i])sum=l[i]; } return true; } int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>l[i]>>r[i]>>s[i]; } double p=0; double eps=1e-7; for(double i=1e8;i>=eps;i/=2){ if(!cal(p+i))p+=i; } cout<<fixed<<setprecision(2)<<p<<endl; return 0; }
by 1234567_scp @ 2023-02-12 10:00:50


$x_i \leq y_i \leq 10^8$
by Loser_Syx @ 2023-02-12 10:06:38


@[Saint_ying_xtf](/user/852144) ~~眼瞎了~~
by ZeroF @ 2023-02-12 10:12:47


@[0x0F](/user/385165) 你改eps干嘛,改的是最后的i,初始1e8
by Loser_Syx @ 2023-02-12 10:16:14


|