QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#176906 | #7110. Kuririn MIRACLE | pengpeng_fudan | WA | 24ms | 4132kb | C++14 | 1.0kb | 2023-09-12 09:50:07 | 2023-09-12 09:50:08 |
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))>eps) 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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 4076kb
input:
1 2.00 3 30.0
output:
8.310580
result:
ok found '8.3105800', expected '8.3105799', error '0.0000000'
Test #2:
score: -100
Wrong Answer
time: 24ms
memory: 4132kb
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:
8.266744 5.488361 5.848700 1.123680 81.291667 15.197115 2.377358 7.140136 37.948148 18.652062 8.112376 52.494382 9.625455 63.311927 16.613861 27.030675 1.017182 13.524911 15.560000 8.858447 1.769764 4.541139 10.473186 5.620603 4.331615 3.147193 8.620545 2.331849 3.651811 3.654000 7.637681 4.686345 0...
result:
wrong answer 1st numbers differ - expected: '4.4578371', found: '8.2667440', error = '0.8544294'