QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#714816 | #7110. Kuririn MIRACLE | reewnat | AC ✓ | 594ms | 4248kb | C++14 | 2.0kb | 2024-11-06 08:22:55 | 2024-11-06 08:22:55 |
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 = 50;
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();
}
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 4236kb
input:
1 2.00 3 30.0
output:
8.3105799933
result:
ok found '8.3105800', expected '8.3105799', error '0.0000000'
Test #2:
score: 0
Accepted
time: 60ms
memory: 4248kb
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.4578371352 5.4883608687 5.8486997636 1.1236802413 43.2664801270 8.3054901755 2.3773584906 4.0154860166 37.9481481481 18.6520618557 4.1551236447 27.1789630205 9.6254545455 63.3119266055 16.6138613861 15.0939946011 1.0171821306 6.9496235050 8.1504303063 8.8584474886 1.7697642164 4.5411392405 10.4731...
result:
ok 100 numbers
Test #3:
score: 0
Accepted
time: 594ms
memory: 4140kb
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.7708826640 8.5674157303 6.2605042017 3.2858638743 4.3137673426 25.1764843661 1.9444444444 11.4062996280 6.8071912092 6.6006144393 10.7277126664 3.8001978461 7.4844843577 16.5100671141 3.7756970152 10.9157110958 3.5175276692 1.1753086420 6.0952874630 14.4431818182 8.4168240822 8.4894553175 6.028112...
result:
ok 1000 numbers
Extra Test:
score: 0
Extra Test Passed