Description

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.

Input

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).

Output

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".

Sample Input

2
1 1 1
3 4 6

Sample Output

YES 0.5000

YES 2.0000

题解:

赛瓦定理+二分精度求解

代码:

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define is_lower(c) (c >= 'a' && c <= 'z')
#define is_upper(c) (c >= 'A' && c <= 'Z')
#define is_alpha(c) (is_lower(c) || is_upper(c))
#define is_digit(c) (c >= '0' && c <= '9')
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define PI acos(-1)
#define IO                 \
  ios::sync_with_stdio(); \
  cin.tie();              \
  cout.tie();
#define For(i, a, b) for (int i = a; i <= b; i++)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
const ll inf = 0x3f3f3f3f;
;
const ll inf_ll = (ll)1e18;
const ll maxn = 100005LL;
const ll mod = 1000000007LL;
 + ;
int main() {
  int T;
  cin >> T;
  double t1, t2, t3;
  while (T--) {
    cin >> t1 >> t2 >> t3;
    // 2t^3 = t1*t2*t3 - (t1 * t2 + t2 * t3 + t3 * t1) * t +
    // (t1 + t2 + t3) * t^2;
    , r = min(t1, min(t2, t3)), t;
    ) {
      t = (l + r) / 2.0;
      double y = t1 * t2 * t3 - (t1 * t2 + t2 * t3 + t3 * t1) * t +
                 (t1 + t2 + t3) * t * t - t * t * t * ;
      )
        l = t;
      else
        r = t;
    }
    printf("YES %.4lf\n", t);
  }
}

山东省第六届省赛 BIGZHUGOD and His Friends II(赛瓦定理)的更多相关文章

  1. 山东省第六届省赛 H题:Square Number

    Description In mathematics, a square number is an integer that is the square of an integer. In other ...

  2. 山东省第六届ACM省赛

    A.Nias and Tug-of-War(sort排序) B.Lowest Unique Price(set+map) C.Game!(博弈) D.Stars E.BIGZHUGOD and His ...

  3. 湖南省第六届省赛题 Biggest Number (dfs+bfs,好题)

    Biggest Number 时间限制:1000 ms  |  内存限制:65535 KB 难度:4 描述 You have a maze with obstacles and non-zero di ...

  4. 山东省第六届ACM省赛 H---Square Number 【思考】

    题目描述 In mathematics, a square number is an integer that is the square of an integer. In other words, ...

  5. 山东省第七届省赛 D题:Swiss-system tournament(归并排序)

    Description A Swiss-system tournament is a tournament which uses a non-elimination format. The first ...

  6. Sdut 2164 Binomial Coeffcients (组合数学) (山东省ACM第二届省赛 D 题)

    Binomial Coeffcients TimeLimit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 输入 输出 示例输入 1 1 10 2 9 ...

  7. Sdut 2165 Crack Mathmen(数论)(山东省ACM第二届省赛E 题)

    Crack Mathmen TimeLimit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Since mathmen take security ...

  8. FZOJ--2221-- RunningMan 福建第六届省赛

    题目链接:http://acm.hust.edu.cn/vjudge/contest/127149#problem/J 题目大意: 因为总共就分三个队,因为两个队都要选取最优的策略,不论B队咋放,要使 ...

  9. Problem 2214 Knapsack problem 福建第六届省赛

    题目链接:http://acm.fzu.edu.cn/problem.php?pid=2214 题目大意:给你T组数据,每组有n个物品,一个背包容量B,每件有体积和价值.问你这个背包容纳的物品最大价值 ...

随机推荐

  1. C语言100例01 PHP版(练习)

    题目:有1.2.3.4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少? 程序分析:可填在百位.十位.个位的数字都是1.2.3.4.组成所有的排列后再去 掉不满足条件的排列. 代码: for ...

  2. 【题解】HNOI2009无归岛

    这题真的是无语了,在哪个岛上根本就没有任何的用处……不过我是画了下图,感受到一定是仙人掌,并不会证.有谁会证的求解…… 如果当做仙人掌来做确实十分的简单.只要像没有上司的舞会一样树形dp就好了,遇到环 ...

  3. [CF735D]Taxes

    题目大意:给你$n$,把它分成若干个数$n_i$,记价值为$\sum_{i=1}^k(\sum_{j|n_i}j-n_i)$(即分成的每个数的约数和(不包括自身)).(以前写的题,不知道为什么没交) ...

  4. javascript 随机数区间

    生成[0,max]之间的随机数 parseInt(Math.random()*(max+1),10);Math.floor(Math.random()*(max+1)); 生成[1,max]之间的随机 ...

  5. 几个JQuery解析XML的程序例子

    用JavaScript解析XML数据是常见的编程任务,JavaScript能做的,JQuery当然也能做.下面我们来总结几个使用JQuery解析XML的例子. 第一种方案: <script ty ...

  6. taotao前台页面显示登录用户名的处理

    思路: 在每个页面上都引入一个 jsp,这个 jsp 可以是页面的头 head 或者脚 footer.jsp 然后在这个 jsp 中引入 一个 js,这个 js 中 有个 随页面加载 而执行的 方法, ...

  7. php函数-shuffle

    Shuffle()函数说明: -随机乱序现有数组并不保留键值: -shuffle()函数把数组中的元素按随机顺序重新排列,该函数为数组中的元素分配新的键名,已有键名将被删除. 语法说明: shuffl ...

  8. MySQL远程访问权限 允许远程连接

    1 首先cd / 到根目录,打开mysql控制台 登录数据库  mysql -u root -p 2.授权远程连接 mysql> use mysql; Database changed mysq ...

  9. ios 全方位修改工程名

    本文针对于彻底修改iOS工程名,不需要另外建工程,会整理的跟新工程完全一样 1. 选中旧工程名,改为新的 然后选择rename 2. 依次选择黄色文件夹,修改名字,千万不要在Xcode外修改!!! 修 ...

  10. oracle导入和导出和授权

    导入数据库: imp demo@orcl file=d:/bak_1023.dmp full=y ignore=y 导出数据库: @orcl file=d:/bak_1023.dmpexp yhtj/ ...