1006 Line belt

Problem Description
In a two-dimensional plane there are two line belts, there are two segments AB and CD, lxhgww's speed on AB is P and on CD is Q, he can move with the speed R on other area on the plane.<br>How long must he take to travel from A to D?
 

Input
The first line is the case number T.<br>For each case, there are three lines.<br>The first line, four integers, the coordinates of A and B: Ax Ay Bx By.<br>The second line , four integers, the coordinates of C and D:Cx Cy Dx Dy.<br>The third line, three integers, P Q R.<br>0<= Ax,Ay,Bx,By,Cx,Cy,Dx,Dy<=1000<br>1<=P,Q,R<=10
 

Output
The minimum time to travel from A to D, round to two decimals.
 

Sample Input
  
  
1<br>0 0 0 100<br>100 0 100 100<br>2 2 1
 

Sample Output
  
  
136.60
 

Author
lxhgww&&momodi



  1. #include<iostream>  
  2. #include<cstdio>  
  3. #include<cmath>  
  4. #define eps 1e-15  
  5. using namespace std;  
  6. struct point  
  7. {  
  8.     double x,y;  
  9. };  
  10. point A,B,C,D;  
  11. double P,Q,R;  
  12. int sgn(double a)  
  13. {  
  14.     return (a>eps)-(a<-eps);  
  15. }  
  16. double dist(point a,point b)  
  17. {  
  18.     return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));  
  19. }  
  20. double calcu_lin(point a,point b,point c,point d)  
  21. {  
  22.     return dist(a,b)/P+dist(b,c)/R+dist(c,d)/Q ;  
  23. }  
  24. point MID(point a,point b)  
  25. {  
  26.     point c;  
  27.     c.x=(a.x+b.x)*0.5;  
  28.     c.y=(a.y+b.y)*0.5;  
  29.     return c;  
  30. }  
  31. double sanfen1(point a,point b,point c,point d,point &mid)  
  32. {  
  33.    point mid1,midmid;  
  34.     point l,rr;l=c;rr=d;  
  35.     double t1,t2;  
  36.    do  
  37.    {  
  38.      mid1=MID(l,rr);  
  39.      midmid=MID(mid1,rr);  
  40.      t1=calcu_lin(a,b,mid1,d);  
  41.      t2=calcu_lin(a,b,midmid,d);  
  42.      if(t1<t2)  
  43.      rr=midmid;  
  44.      else  
  45.      l=mid1;  
  46.    }  
  47.    while(sgn(t1-t2)!=0);  
  48.    mid=mid1;  
  49.    return  t1;  
  50. }  
  51. double sanfen2(point d,point c,point b,point a,point &mid)  
  52. {  
  53.    point mid1,midmid;  
  54.     point l,rr;l=a;rr=b;  
  55.     double t1,t2;  
  56.    do  
  57.    {  
  58.      mid1=MID(l,rr);  
  59.      midmid=MID(mid1,rr);  
  60.      t1=calcu_lin(a,mid1,c,d);  
  61.      t2=calcu_lin(a,midmid,c,d);  
  62.      if(t1<t2)  
  63.      rr=midmid;  
  64.      else  
  65.      l=mid1;  
  66.    }  
  67.    while(sgn(t1-t2)!=0);  
  68.    mid=mid1;  
  69.    return  t1;  
  70. }  
  71. void work()  
  72. {  
  73.     double t1,t2;point mid1,mid2;  
  74.     mid1.x=B.x;mid1.y=B.y;  
  75.     do  
  76.     {  
  77.         //printf("okok\n");  
  78.       t1=sanfen1(A,mid1,C,D,mid2);  
  79.       t2=sanfen2(D,mid2,B,A,mid1);  
  80.     }  
  81.     while(sgn(t1-t2)!=0);  
  82.     printf("%.2lf\n",t1);  
  83. }  
  84. int main()  
  85. {  
  86.     int t;  
  87.     double ff;  
  88.     scanf("%d",&t);  
  89.      while(t--)  
  90.     {  
  91.         scanf("%lf%lf%lf%lf",&A.x,&A.y,&B.x,&B.y);  
  92.         scanf("%lf%lf%lf%lf",&C.x,&C.y,&D.x,&D.y);  
  93.         scanf("%lf%lf%lf",&P,&Q,&R);  
  94.           work();  
  95.   
  96.   
  97.     }  
  98.   
  99.     return 0;  


内容概要:本文详细介绍了OCR(光学字符识别)技术,从定义出发,阐述了它是如何让计算机“看懂”图片里的文字,通过扫描仪等设备读取文本图像并转换成计算机可编辑的文本。文中列举了OCR在办公、图书馆、交通、金融等领域的广泛应用实例,如快速处理纸质文件、车牌识别、银行支票处理等。接着回顾了OCR的发展历程,从20世纪初的萌芽到如今基于深度学习的智能化时代,期间经历了从简单字符识别到复杂场景下的高精度识别的演变。技术层面,深入解析了OCR的关键技术环节,包括图像预处理、文本检测、文本识别和后处理,每个环节都采用了先进的算法和技术手段以确保识别的准确性。最后探讨了OCR在未来可能面临的挑战,如复杂场景下的识别准确率、特殊字体和语言的支持以及数据安全问题,并展望了其与人工智能融合后的广阔前景。 适合人群:对OCR技术感兴趣的技术爱好者、开发者以及希望了解该技术在各行业应用的专业人士。 使用场景及目标:①帮助用户理解OCR技术的基本原理和发展历程;②展示OCR在多个行业中的具体应用场景,如办公自动化、金融票据处理、医疗病历管理等;③探讨OCR技术面临的挑战及未来发展方向,为相关从业者提供参考。 其他说明:本文不仅涵盖了OCR技术的基础知识,还深入探讨了其背后的技术细节和发展趋势,对于想要深入了解OCR技术及其应用的人来说是非常有价值的参考资料。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值