QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#714814 | #7110. Kuririn MIRACLE | reewnat | WA | 0ms | 4140kb | C++14 | 2.0kb | 2024-11-06 08:21:23 | 2024-11-06 08:21:23 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define double long double
#define ll long long int
#define ull unsigned long long int
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vl vector<ll>
#define vvl vector<vl>
#define vi vector<int>
#define vvi vector<vi>
#define Imspeed ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define no cout<<"NO\n";
#define yes cout<<"YES\n";
const double pi = acos(-1);
const double steps = 10;
const ll n = 1e6 + 2;
const ll mod = 1e9+7;
const double eps = 1e-10;
void pre(){
}
double fun(double v, double r, double phi){
return 2.0*r*(sqrt(3.0+cos(pi/2.0-phi)*cos(pi/2.0-phi))+cos(pi/2.0-phi))/(3.0*v);
}
double sims(double v, double r, double a, double b){
double s = fun(v,r,a)+fun(v,r,b), h=(b-a)/steps;
for(double i=1.0;i<steps;i++){
if(int(i)%2) s += 4.0*fun(v,r,i*h);
else s += 2.0*fun(v,r,i*h);
}
s *= (h/3.0);
return s;
}
void solu(){
cout<<fixed<<setprecision(10);
double v=2.00,r=3,d=30.00;
cin>>v>>r>>d;
double low = pi/2, high = pi, mid, t, tt;
int f=0,c=100;
while(c--){
mid = (low+high)/2.0;
t = sims(v,r,0,mid), tt = (d-2.0*r*(1.0+1.0/sin(mid-pi/2)))/v;
//cout<<t<<" "<<mid<<endl;
double x = 2*r * (1 - cos(mid)) + t * v;
double y = 2*r * sin(mid);
double omega = 1/fun(v,r,mid);
double vx = 2*r * omega * sin(mid) + v;
double vy = 2*r * omega * cos(mid);
if (x - y * vx / vy <= d){
high = mid;
f = 1;
}
else low = mid;
}
if(f){
double x = 2*r * (1 - cos(mid)) + t * v;
double y = 2*r * sin(mid);
double t2 = sqrt((x - d) * (x - d) + y * y) / (v * 2);
if(v*(t+t2)+2*r<=d){
cout<<t+t2<<endl;
return;
}
}
cout<<d/v<<endl;
}
int main(){
Imspeed
//freopen("input.txt", "r", stdin);
//freopen("1out.txt", "w", stdout);
pre();
int t=1;
cin>>t;
for(int i=1;i<=t;i++){
//cout<<"Case #"<<i<<": ";
solu();
}
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 4140kb
input:
1 2.00 3 30.0
output:
8.3106176956
result:
wrong answer 1st numbers differ - expected: '8.3105799', found: '8.3106177', error = '0.0000045'