QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#714812 | #7110. Kuririn MIRACLE | reewnat | TL | 111ms | 4296kb | C++14 | 2.0kb | 2024-11-06 08:18:13 | 2024-11-06 08:18:13 |
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 = 100;
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==0){
cout<<d/v<<endl;
return;
}
//cout<<t<<" "<<mid<<endl;
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);
cout<<t+t2<<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: 100
Accepted
time: 2ms
memory: 4296kb
input:
1 2.00 3 30.0
output:
8.3105799376
result:
ok found '8.3105799', expected '8.3105799', error '0.0000000'
Test #2:
score: 0
Accepted
time: 111ms
memory: 4196kb
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.4578371235 5.4883608127 5.8486997636 1.1236802413 43.2664800581 8.3054901405 2.3773584906 4.0154859724 37.9481481481 18.6520618557 4.1551236436 27.1789630079 9.6254545455 63.3119266055 16.6138613861 15.0939944699 1.0171821306 6.9496235029 8.1504302997 8.8584474886 1.7697642164 4.5411392405 10.4731...
result:
ok 100 numbers
Test #3:
score: -100
Time Limit Exceeded
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.7708826502 8.5674157303 6.2605042017 3.2858638743 4.3137673426 25.1764841842 1.9444444444 11.4062996171 6.8071912059 6.6006144393 10.7277125674 3.8001978449 7.4844843061 16.5100671141 3.7756970123 10.9157110720 3.5175276475 1.1753086420 6.0952874404 14.4431818182 8.4168240747 8.4894553082 6.028112...