HDU 2105 The Center of Gravity
来源:互联网 发布:xlwt与python 编辑:程序博客网 时间:2024/05/17 05:57
利用重心的特点 设 A(x1,y1) B(x2,y2) C(x3,y3)
BC的中点D 重心为点O,可知 D的坐标 [(x2+x3)/2,(y2+y3)/2]
利用0A=2OD 得: 0x= (Dx-Ax)*2/3 + Ax Oy=(Dy-Ay)*2/3 +Ay
#include<stdio.h>
int main()
{
double x,y,x1,y1,x2,y2,x3,y3;
int t;
while(scanf("%d",&t)!=EOF && t)
{
while(t--){
scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
x=(x1+x2)/2;
y=(y1+y2)/2;
x=(x-x3)*2/3+x3;
y=(y-y3)*2/3+y3;
printf("%.1lf %.1lf\n",x,y);
}
}
return 0;
}
- HDU 2105 The Center of Gravity
- HDU 2105 The Center of Gravity
- hdu-2105-The Center of Gravity
- HDU 2105 The Center of Gravity
- hdu 2105 The Center of Gravity
- HDU 2105 The Center of Gravity (水题)
- HDU——2105 The Center of Gravity
- The Center of Gravity
- The Center of Gravity
- The Center of Gravity
- hoj 2105The Center of Gravity
- HDOJ题目2105The Center of Gravity
- The Center of Gravity hdu2105
- HDOJ2105 The Center of Gravity
- HDU--杭电--2105--The Center of Gravity--数学题,求三角形重心
- ACM--三角形重心--HDOJ 2105--The Center of Gravity
- ACM--三角形重心--HDOJ 2105--The Center of Gravity--水
- HDOJ 2105 The Center of Gravity(超级水题)
- 图学PowerBuilder---PB中的一些小问题及解决
- Qt基础——Qt4.7安装 windows7+Qt+VS2008
- 将中缀表达式转换为后缀表达式的简便方法
- FullCalendar(日程管理控件)
- 50条狗中有多少条病狗?
- HDU 2105 The Center of Gravity
- 五大开源游戏引擎介绍
- JSP
- UVA 573 蜗牛
- 使用QUiLoader来动态加载.ui文件
- QUiLoader:彻底分离你的Ui设计工作(含例子)
- Android入门(5)最简单的Handler例子
- S5PV210 WinCE6.0 使用双通道512MmDDR(256mx2)
- Qt探秘——谈ui文件的用法