LightOj1385 - Kingdom Division(数学几何题)
题目链接:http://lightoj.com/volume_showproblem.php?problem=1385
题意:下图中已知面积 a b c 求 d; 如果d的面积不确定,输出-1。
连接AX,记△AFX的面积为m,△AEX的面积为n。
因为△AFX与△BFX共高线,所以m/a = AF/FB;
又因为(n+c)与b共底边,高线所在的三角形相似,高线只比为AF/FB = (n+c)/b = m/a。
同理可得(m+a)/b = n/c = AE/CE
然后解二元一次方程组求得
m = (abc+ac2)/(b2-ac);
n = (abc+a2c)/(b2-ac);
当b2-ac=0时答案为-1;
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
using namespace std;
#define met(a, b) memset(a, b, sizeof(a))
#define maxn 10005
#define maxm 20005
#define INF 0x3f3f3f3f
typedef long long LL; int main()
{
int T, t = ;
double a, b, c;
scanf("%d", &T);
while(T--)
{
scanf("%lf %lf %lf", &a, &b, &c);
if(b*b - a*c <1e-)
printf("Case %d: -1\n", t++);
else
printf("Case %d: %.6f\n", t++, (a*a*c+a*c*c+*a*b*c)/(b*b-a*c));
}
return ;
}
LightOj1385 - Kingdom Division(数学几何题)的更多相关文章
- hdu 1577 WisKey的眼神 (数学几何)
WisKey的眼神 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total S ...
- Hacker Rank: Kingdom Division 不完全报告
原题链接: Kingdom Division 由于树的层次可能很深,所以这里不能使用递归版的DFS.我使用了BFS. BFS确定各结点的父结点和它的孩子数. 用逆拓扑排序确定结点的计算顺序. same ...
- [Swust OJ 771]--奶牛农场(几何题,画图就好)
题目链接:http://acm.swust.edu.cn/problem/771/ Description 将军有一个用栅栏围成的矩形农场和一只奶牛,在农场的一个角落放有一只矩形的箱子,有一天将 ...
- UVA - 10014 - Simple calculations (经典的数学推导题!!)
UVA - 10014 Simple calculations Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & ...
- PJ考试可能会用到的数学思维题选讲-自学教程-自学笔记
PJ考试可能会用到的数学思维题选讲 by Pleiades_Antares 是学弟学妹的讲义--然后一部分题目是我弄的一部分来源于洛谷用户@ 普及组的一些数学思维题,所以可能有点菜咯别怪我 OI中的数 ...
- hdu 1115 Lifting the Stone (数学几何)
Lifting the Stone Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- 天哪!毫无思绪!令人感到恐惧的数学(水题?)(TOWQs)
这道题的题目描述灰常简单,第一眼看以为是一道十分水的题目: 但是!!!(我仔细一看也没有发现这背后隐藏着可怕的真相~) 下面给出题目描述: 给出一个整数x,你可以对x进行两种操作.1.将x变成4x+3 ...
- ACM: FZU 2110 Star - 数学几何 - 水题
FZU 2110 Star Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Pr ...
- nyoj--1011--So Easy[II](数学几何水题)
So Easy[II] 时间限制:1000 ms | 内存限制:65535 KB 难度:2 描述 这是一道基础的计算几何问题(其实这不提示大家也都看的出).问题描述如下: 给你一个N边形.且N边形 ...
随机推荐
- BZOJ3211 花神游历各国
Description Input Output 每次x=1时,每行一个整数,表示这次旅行的开心度 Sample Input 4 1 100 5 5 5 1 1 2 2 1 2 1 1 2 2 ...
- CentOS下搭建使用gitlab 和tortoiseGit使用
gitlab和github 一样很爽的一个东西 关于gitlab在CentOS下的安装方法地址参考: https://github.com/gitlabhq/gitlab-recipes/tree/m ...
- 利用Oracle的row_number() over函数消除重复的记录
.select d.id,d.outer_code from dict_depts_source d order by outer_code(查看重复数据) .select d.id,d.outer_ ...
- spark-shell --conf
spark-shell --conf -h Usage: ./bin/spark-shell [options] Options: --master MASTER_URL spark://host:p ...
- Asp.Net 常用代码-备用
1.DropDownList 复制 //DropDownList DropDownList2.Items.Clear(); foreach (ListItem li in DropDownList1. ...
- kail-linux 下载地址
http://archive-6.kali.org/kali-images/kali-2016.1/kali-linux-2016.1-i386.iso 选择debian 32/64bit安装 开始启 ...
- 【新产品发布】《GM1001 4~20mA 高精度电流采集模块》
一.主要特性 1.测量精度高达±0.01%FS±0.002mA: 2.采样电阻仅10欧姆(20mA时压降仅0.2V),对被测系统影响 微乎其微: 3.差分输入,可测量正反电流无需改动硬件,使用方便: ...
- Tesla-> Fermi (550Ti) -> Kepler(680) -> Maxwell (750Ti) -> Volta(was Pascal)
Pascal GPU Pascal (from French mathematician Blaise Pascal) is Maxwell successor. In this news, we l ...
- wordpress 常用函数 checked(),selected(),disabled()
checked().selected().disabled(),这三个函数是主题设计和插件设计中添加后台设置比较常用到的函数. 例如自定义一个widget,这个widget有一个字段为文章排列方式.文 ...
- 初学Java,第一段代码
public class myapp { public static void main(String[] args) { // TODO Auto-generated method stub Sys ...