zoukankan      html  css  js  c++  java
  • E







    #include <set> #include <map> #include <deque> #include <queue> #include <stack> #include <cmath> #include <ctime> #include <bitset> #include <cstdio> #include <string> #include <vector> #include <cstdlib> #include <cstring> #include <cassert> #include <iostream> #include <algorithm> #include <unordered_map> using namespace std; const int INF=0x3f3f3f3f; typedef long long LL; typedef pair<LL, LL> pLL; typedef pair<LL, int> pLi; typedef pair<int, LL> pil;; typedef pair<int, int> pii; typedef unsigned long long uLL; //这道题没有考虑加速度,且是在塔外面往塔上跳 //长时间未敲代码,double的输入输出都不会了
    //既然一定跳到圆锥上,那么可以假设这点是(x,y,z),然后根据圆锥的截面建立方程x*x+y*y=r1*r1
    double x,y,z,vx,vy,vz,r,h; bool check(double t) { double x1=x+vx*t; double y1=y+vy*t; double z1=z+vz*t; //printf("%f ",z1); if(z1<0||z1>h)return false; return (x1*x1+y1*y1-(1-z1/h)*(1-z1/h)*r*r)<=1e-8; } int main() { int t; scanf("%d",&t); int kase=0; while(t--) { scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&r,&h,&x,&y,&z,&vx,&vy,&vz); // printf("%f %f %f %f %f %f %f %f ",r,h,x,y,z,vx,vy,vz); double a=vz*vz*r*r/(h*h)-vx*vx-vy*vy; double b=2*z*vz*r*r/(h*h)-2*vz*r*r/h-2*x*vx-2*y*vy; double c=r*r*((h-z)/h)*((h-z)/h)-x*x-y*y; //printf("%f %f %f ",a,b,c); double t1=(-b+sqrt(b*b-4*a*c))/(2*a); double t2=(-b-sqrt(b*b-4*a*c))/(2*a); // // printf("%f ==== %f ",t1,t2); double ans=INF; if(check(t1))ans=min(ans,t1); if(check(t2))ans=min(ans,t2); printf("Case %d: %.10f ",++kase,ans); } return 0; }
  • 相关阅读:
    简易高重用的jdbcutils工具封装实现类以及简易连接池实现
    http header 具体解释
    zoj 3888 Twelves Monkeys 二分+线段树维护次小值
    hyperLink的定制
    document.body.clientHeight的取值
    在循环中创建网页元素的问题
    mongo db 启动停止
    myeclipse 2014破解
    weblogic 集群部署时上传jsp不更新问题
    Spring classPath:用法
  • 原文地址:https://www.cnblogs.com/zhangzhenjun/p/12238503.html
Copyright © 2011-2022 走看看