CDOJ--1816
原题链接:http://acm.uestc.edu.cn/problem.php?pid=1816
分析:一道数学题。
BiliBili, ACFun… And More
1 #include<stdio.h> 2 int main() 3 { 4 double time(double x,double y,double t,double s); 5 int T,cas=1; 6 double x,y,t,s; 7 scanf("%d",&T); 8 while(T--) 9 { 10 scanf("%lf%lf%lf%lf",&x,&y,&t,&s); 11 printf("Case #%d: %.3lf\n",cas++,time(x,y,t,s)); 12 } 13 return 0; 14 } 15 double time(double x,double y,double t,double s) 16 { 17 double p; 18 if(x<=y||((x*y*t)>=((x-y)*s))) 19 return s*(1.0)/x; 20 else 21 { 22 p=y*t*(1.0)/(x-y)+t; 23 return (time(x,y,p,s)+p-t); 24 } 25 } 26