sdut 3256 BIGZHUGOD and His Friends II

BIGZHUGOD and His Friends II

Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^

题目描述

BIGZHUGOD and his three friends are playing a game in a triangle ground.
The number of BIGZHUGOD is 0, and his three friends are numbered from 1 to 3. Before the game begins, three friends stand on three vertices of triangle in numerical order (1 on A, 2 on B, 3 on C), BIGZHUGOD stands inside of triangle.
Then the game begins, three friends run to the next vertex in uniform speed and in straight direction (1 to B, 2 to C, 3 to A and there speeds may different). And BIGZHUGOD can stand in any position inside the triangle.
When any of his friends arrives at next vertex, the game ends.
BIGZHUGOD and his friends have made an agreement: we assume that the beginning is time 0, if during the game, you can find a moment that BIGZHUGOD can block the sight line of 1 to C, 2 to A, 3 to B. Then each friend has to treat BIGZHUGOD with a big meal.
Now BIGZHUGOD knows the lengths of time that his three friends need run to next vertices t1, t2 and t3. He wants to know whether he has a chance to gain three big meals, of course he wants to know in which exciting moment t, he can block three friends\' sight line.
 

输入

 The first line contains an integer T, indicating the number of test cases (T ≤ 1000).
For each case there are three integer t1, t2, t3 (1 ≤ t1, t2, t3 ≤ 100).
 

输出

 If BIGZHUGOD has a chance to gain big meal from his friends, output "YES" and the exciting moment t rounding to 4 digits after decimal point. Otherwise, output "NO".

示例输入

2 
1 1 1 
3 4 6

示例输出

YES 0.5000 
YES 2.0000

提示

 

来源

 

示例程序

 

  • 提交 
  • 状态 
  • 讨论
    • 有3个人在三角形的3个顶点ABC 他们分别以1/t1 1/t2 1/ t3 的速度从A->B B->C C->A的路径
    • 问有没有在某一时刻使得这3人与之对角的连线交与一点
    • 其实这就是赛瓦定理


    • 图片来至知乎
    • 知道这个定理后这题就很水了
    • 列个方程二分枚举下答案就好了
    • //精度搞错wa了好久还找程序对拍也没找出问题- - 太菜啦
    • ACcode:
    • #include <cstdio>
      #include <cmath>
      #define mid ((l+r)/2)
      int main(){
          int loop;
          scanf("%d",&loop);
          while(loop--){
              double l,r,tmp,t1,t2,t3;
              scanf("%d%d%d",&t1,&t2,&t3);
              l=0.0;r=t1>t2?t2:t1;r=r>t3?t3:r;
              while(fabs(r-l)>1e-8){
                  tmp=2*mid*mid*mid-(t1+t2+t3)*mid*mid+(t1*t2+t2*t3+t1*t3)*mid-(t1*t2*t3);
                  if(fabs(tmp)<1e-8)break;
                  if(tmp>0)r=mid;
                  else l=mid;
              }
              printf("YES %0.4f\n",mid);
          }
          return 0;
      }
      


SDUT(山东理工职业学院)在Java教学方面,通常会涵盖Java编程基础、面向对象编程、异常处理、集合框架、流式编程、文件操作以及数据库访问等内容。Java作为一种广泛使用的编程语言,因其平台无关性、面向对象、安全性等特点,在高校及企业中非常受欢迎。在教学过程中,学生会通过理论学习和实践练习来掌握Java语言的核心概念和应用。 学生在学习Java时,会逐步了解如何使用Java开发环境,例如安装JDK、配置环境变量等,之后会通过编写小程序来实践基本语法,如数据类型、控制流(if-else、switch、循环等)、数组的使用等。进一步,学生将学习类与对象的创建和使用,掌握继承、多态等面向对象编程的基本概念,并通过接口和抽象类的应用来实现多态。 异常处理方面,学生会学习如何捕获和处理运行时可能出现的错误,提高程序的健壮性。Java的集合框架,包括List、Set、Map等接口和实现类,是处理数据集合的重要工具,学生会学习如何操作这些集合。流式编程是Java 8引入的一个重要特性,学生会学习Lambda表达式和Stream API的使用,以实现更加简洁和高效的数据处理。 文件操作和数据库访问是Java应用程序与数据存储交互的常见方式。学生会学习如何使用Java I/O类读写文件,以及使用JDBC与关系数据库进行数据的存取操作。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值