QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#714815#7110. Kuririn MIRACLEreewnatWA 1ms4120kbC++142.0kb2024-11-06 08:22:342024-11-06 08:22:34

Judging History

你现在查看的是最新测评结果

  • [2024-11-06 08:22:34]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4120kb
  • [2024-11-06 08:22:34]
  • 提交

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();
  }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 4120kb

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'