题目链接:https://vjudge.net/contest/121192#problem/L

这是一道很有意思的题,就是给定一个以原点为圆心的圆,然后给定 一个点  求最大三角的 其他的坐标 ,很容易知道这个三角形一定是等边三角形,所以圆心就是三角形的重心,刚开始用直线的方程来写,还要解一个复杂的一元二次方程,十分复杂,后来又想到一种简单的方法

这样就可以得到一个点的坐标  又重心为圆点  则三点的横坐标之和为0 总坐标之和为0

ac代码:

 import java.io.BufferedInputStream;
import java.text.DecimalFormat;
import java.util.Scanner; public class Main {
public static void main(String[] args) {
DecimalFormat format = new DecimalFormat("0.000");
Scanner s = new Scanner(new BufferedInputStream(System.in));
int t = s.nextInt();double x,y,x1,y1,x2,y2, c,r,a,b,d;
while(t-->){
x = s.nextDouble();y = s.nextDouble();
r=Math.sqrt(x*x+y*y);
a=r*r;
b=r*r*y;
c=r*r*r*r/-x*x*r*r;
d=b*b-*a*c;
y1=(-*b-Math.sqrt(d))/(*a);
y2=(-*b+Math.sqrt(d))/(*a);
if(x==)
{
x1=-Math.sqrt(r*r-y1*y1);
x2=Math.sqrt(r*r-y2*y2);
}
else
{
x1=(-*r*r/-y*y1)/x;
x2=(-*r*r/-y*y2)/x;
}
System.out.println(format.format(x1)+" "+format.format(y1)+" "+format.format(x2)+" "+format.format(y2));
}
s.close();
}
}

2016HUAS暑假集训训练2 L - Points on Cycle的更多相关文章

  1. 暑假集训(2)第九弹 ----- Points on Cycle(hdu1700)

                                                Points on Cycle Time Limit:1000MS     Memory Limit:32768 ...

  2. 2016HUAS暑假集训训练题 B - Catch That Cow

    B - Catch That Cow Description Farmer John has been informed of the location of a fugitive cow and w ...

  3. 2016HUAS暑假集训训练2 O - Can you find it?

    题目链接:http://acm.hust.edu.cn/vjudge/contest/121192#problem/O 这道题是一道典型二分搜素题,题意是给定3个数组 每个数组的数有m个 再给定l个s ...

  4. 2016HUAS暑假集训训练题 F - 简单计算器

    Description 读入一个只包含 +, -, *, / 的非负整数计算表达式,计算该表达式的值.    Input 测试输入包含若干测试用例,每个测试用例占一行,每行不超过200个字符,整数和运 ...

  5. 2016HUAS暑假集训训练2 K - Hero

    题目链接:http://acm.hust.edu.cn/vjudge/contest/121192#problem/K 这也是一道贪心题,刚开始写时以为只要对每一敌人的攻击和血的乘积进行从小到大排序即 ...

  6. 2016HUAS暑假集训训练2 J - 今年暑假不AC

    题目链接:http://acm.hust.edu.cn/vjudge/contest/121192#problem/J 此题要求是计算能够看到最多的节目 ,贪心算法即可,首先对结束时间排序,然后在把开 ...

  7. 2016huas暑假集训训练题 G-Who's in the Middle

    题目链接:http://acm.hust.edu.cn/vjudge/contest/121192#problem/G 此题大意是给定一个数n 然后有n个数 要求求出其中位数  刚开始以为是按数学中的 ...

  8. 2016HUAS暑假集训训练2 F - A Simple Problem with Integers

    Description 给出了一个序列,你需要处理如下两种询问. "C a b c"表示给[a, b]区间中的值全部增加c (-10000 ≤ c ≤ 10000). " ...

  9. 2016HUAS暑假集训训练2 E - I Hate It

    Description 很多学校流行一种比较的习惯.老师们很喜欢询问,从某某到某某当中,分数最高的是多少.这让很多学生很反感. 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老 ...

随机推荐

  1. js不间断平滑地自动向上滚动

    <html> <head> <title>scroll up auto smooth</title> <style> *{ margin: ...

  2. TestNg依赖配置基础用法(单一方法依赖)------TestNg依赖详解(一)

    TestNg依赖测试之简单方法依赖,通过dependsOnMethods属性来配置依赖方法 原创文章,版权所有,允许转载,标明出处:http://blog.csdn.net/wanghantong J ...

  3. fzu月赛 2203 单纵大法好 二分

    Accept: 8    Submit: 18Time Limit: 5000 mSec    Memory Limit : 65536 KB  Problem Description 人在做,天在看 ...

  4. uva748 - Exponentiation

    import java.io.*; import java.text.*; import java.util.*; import java.math.*; public class Exponenti ...

  5. CF#335 Lazy Student

    Lazy Student time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...

  6. spring事务配置详解

    一.前言 好几天没有在对spring进行学习了,由于这几天在赶项目,没有什么时间闲下来继续学习,导致spring核心架构详解没有继续下去,在接下来的时间里面,会继续对spring的核心架构在继续进行学 ...

  7. gson 简要使用

    http://www.cnblogs.com/chenlhuaf/archive/2011/05/01/gson_test.html 发现了google的gson,因为之前对于protocolbuf有 ...

  8. sed 格式化输出df -h

    df -h|sed '1d;/ /!N;s/\n//;s/ \+/ /;' 1d——————删除第一行 / /!N——————没有空格的行执行N 例子中没有空格的行 /dev/mapper/vg_ds ...

  9. ACM: Ubiquitous Religions-并查集-解题报告

    Ubiquitous Religions Time Limit:5000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu Descript ...

  10. java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries

    在已经搭建好的集群环境Centos6.6+Hadoop2.7+Hbase0.98+Spark1.3.1下,在Win7系统Intellij开发工具中调试Spark读取Hbase.运行直接报错: ? 1 ...