QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#176911 | #7110. Kuririn MIRACLE | pengpeng_fudan | AC ✓ | 230ms | 4504kb | C++14 | 1.0kb | 2023-09-12 10:01:33 | 2023-09-12 10:01:33 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ull=unsigned long long;
using ll=long long;
const double eps=1e-8;
double v,d,r;
double f(double x){
return sqrt(3+sin(x)*sin(x))+sin(x);
}
double simpson(double l,double r){
return (r-l)*(f(l)+f(r)+4*f((l+r)/2))/6;
}
double asr(double l,double r,double ans){
double m=(l+r)/2,a=simpson(l,m),b=simpson(m,r);
if(fabs(a+b-ans)<eps) return ans;
return asr(l,m,a)+asr(m,r,b);
}
double check(double alfa){
return 2.0*r/3*asr(0,alfa,simpson(0,alfa))-2.0*r/3*tan(alfa)*f(alfa)-(d+2*r/cos(alfa));
}
const double Pi=acos(-1);
void solve() {
cin>>v>>r>>d;
d-=2*r;
double l=Pi/2,ri=Pi;
while(fabs(l-ri)>eps){
double mid=(l+ri)/2;
//cout<<check(mid)<<'\n';
if(check(mid)>=0) l=mid;
else ri=mid;
}
if(fabs(check(l))>1e-2) printf("%.6f\n",(d+2*r)/v);
else{
printf("%.6f\n",(d+2*r/cos(l))/v);
}
}
int main() {
ios::sync_with_stdio(0),cin.tie(0);
int _ = 1;
cin >> _;
while(_--) solve();
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 4436kb
input:
1 2.00 3 30.0
output:
8.310580
result:
ok found '8.3105800', expected '8.3105799', error '0.0000000'
Test #2:
score: 0
Accepted
time: 24ms
memory: 4504kb
input:
100 8.66 6.05 71.59 8.44 8.67 82.55 4.23 9.68 24.74 6.63 9.95 7.45 1.2 7.27 97.55 2.08 2.94 31.61 8.48 5.56 20.16 7.35 5.55 52.48 1.35 8.15 51.23 3.88 9.02 72.37 7.03 1.97 57.03 1.78 4.44 93.44 5.5 6.11 52.94 1.09 9.64 69.01 1.01 3.54 16.78 1.63 4.55 44.06 5.82 5.51 5.92 5.62 2.93 76.01 4.75 4.43 73...
output:
4.457837 5.488361 5.848700 1.123680 43.266480 8.305490 2.377358 4.015486 37.948148 18.652062 4.155124 27.178963 9.625455 63.311927 16.613861 15.093995 1.017182 6.949623 8.150430 8.858447 1.769764 4.541139 10.473186 5.620603 4.331615 3.147193 4.557968 1.222899 3.651811 3.654000 3.982207 4.686345 0.26...
result:
ok 100 numbers
Test #3:
score: 0
Accepted
time: 230ms
memory: 4432kb
input:
1000 7.52 6.68 80.67 5.34 6.82 45.75 3.57 6.35 22.35 9.55 3.65 31.38 9.37 5.73 40.42 1.83 8.38 82.97 4.86 6.13 9.45 3.88 5.34 84.19 6.49 4.15 85.24 6.51 7.23 42.97 3.0 5.98 57.53 9.35 2.76 69.07 6.76 9.16 91.24 2.98 9.89 49.2 9.16 3.85 66.14 1.84 3.03 37.43 8.01 5.04 50.98 4.05 9.86 4.76 5.4 5.49 60...
output:
5.770883 8.567416 6.260504 3.285864 4.313767 25.176484 1.944444 11.406300 6.807191 6.600614 10.727713 3.800198 7.484484 16.510067 3.775697 10.915711 3.517528 1.175309 6.095287 14.443182 8.416824 8.489455 6.028112 14.641104 0.981183 15.273224 2.098678 5.099177 18.688406 6.387976 5.593926 8.394133 5.6...
result:
ok 1000 numbers
Extra Test:
score: 0
Extra Test Passed