1043 - Triangle Partitioning(数学)
Time Limit: 0.5 second(s) | Memory Limit: 32 MB |
See the picture below.
You are given AB, AC and BC. DE is parallel to BC. You are also given the area ratio between ADE and BDEC. You have to find the value of AD.
Input
Input starts with an integer T (≤ 25), denoting the number of test cases.
Each case begins with four real numbers denoting AB, AC, BC and the ratio of ADE and BDEC (ADE / BDEC). You can safely assume that the given triangle is a valid triangle with positive area.
Output
For each case of input you have to print the case number and AD. Errors less than 10-6 will be ignored.
Sample Input |
Output for Sample Input |
4 100 100 100 2 10 12 14 1 7 8 9 10 8.134 9.098 7.123 5.10 |
Case 1: 81.6496580 Case 2: 7.07106781 Case 3: 6.6742381247 Case 4: 7.437454786 |
题解:注意面积比是变长比的平方,另外p+1代表s/s2;s代表总面积,s2代表下面的四边形面积
代码:
- #include<iostream>
- #include<cstring>
- #include<cstdio>
- #include<cmath>
- #include<vector>
- #include<map>
- #include<algorithm>
- using namespace std;
- #define mem(x,y) memset(x,y,sizeof(x))
- #define SI(x) scanf("%d",&x)
- #define SL(x) scanf("%lld",&x)
- #define PI(x) printf("%d",x)
- #define PL(x) printf("%lld",x)
- #define P_ printf(" ")
- #define T_T while(T--)
- typedef long long LL;
- const int INF=0x3f3f3f3f;
- int main(){
- int kase=0;
- double a,b,c,p;
- double d,area,ans;
- int T;
- SI(T);
- T_T{
- scanf("%lf%lf%lf%lf",&a,&b,&c,&p);
- double k=p+1.0;
- p=sqrt(1.0-1/k);
- printf("Case %d: %lf\n",++kase,a*p);
- }
- return 0;
- }
1043 - Triangle Partitioning(数学)的更多相关文章
- 二分--1043 - Triangle Partitioning
1043 - Triangle Partitioning PDF (English) Statistics Forum Time Limit: 0.5 second(s) Memory Limit: ...
- Lightoj 1043 - Triangle Partitioning【二分】
题目链接:http://lightoj.com/volume_showproblem.php? problem=1043 题意:一个三角形ABC,DE//BC.已知三角形ADE和四边形BDEC的面积的 ...
- BNU27932——Triangle——————【数学计算面积】
Triangle Time Limit: 1000ms Memory Limit: 65536KB 64-bit integer IO format: %lld Java class nam ...
- Kattis - triangle 【数学】
题意 求第N个迭代三角形 中 所有黑色三角形的周长的整数部分的位数 思路 该三角形的周长是 3^(n + 1)/ 2 ^ (n) 然后 可以用 long double 存下来 再求位数 就可以 AC ...
- lightoj刷题日记
提高自己的实力, 也为了证明, 开始板刷lightoj,每天题量>=1: 题目的类型会在这边说明,具体见分页博客: SUM=54; 1000 Greetings from LightOJ [简单 ...
- lightoj--1043-- Triangle Partitioning (水题)
Triangle Partitioning Time Limit: 500MS Memory Limit: 32768KB 64bit IO Format: %lld & %llu S ...
- LaTeX 各种命令,符号
函数.符号及特殊字符 声调 语法 效果 语法 效果 语法 效果 \bar{x} \acute{\eta} \check{\alpha} \grave{\eta} \breve{a} \ddot{y} ...
- acdream.A Very Easy Triangle Counting Game(数学推导)
A - A Very Easy Triangle Counting Game Time Limit:1000MS Memory Limit:64000KB 64bit IO Forma ...
- HDU 5914 Triangle 数学找规律
Triangle 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5914 Description Mr. Frog has n sticks, who ...
随机推荐
- PHP图片裁剪函数(图像不变形)
PHP图片裁剪函数(图像不变形) <? *exif_imagetype -- 判断一个图像的类型 *说明:函数功能是把一个图像裁剪为任意大小的图像,图像不变形 * 参数说明:输入 需要处理图片的 ...
- 关于scala和java 在maven项目中混编的问题
1.需要添加scala 相关maven配置: <properties> <scala.version>2.10.1</scala.version> <slf4 ...
- R与数据分析旧笔记(六)多元线性分析 下
逐步回归 向前引入法:从一元回归开始,逐步加快变量,使指标值达到最优为止 向后剔除法:从全变量回归方程开始,逐步删去某个变量,使指标值达到最优为止 逐步筛选法:综合上述两种方法 多元线性回归的核心问题 ...
- 在CentOS 7 / Gnome 3 双屏时设置主屏
在Windows中设置扩展显示器为主屏的方式非常清楚,但在Linux中就不是那么明显了,下面介绍如何完成这个设置 ------------------------------------------- ...
- 树莓派高级GPIO库,wiringpi2 for python使用笔记(三)GPIO操作
GPIO库的核心功能,当然就是操作GPIO了,GPIO就是"通用输入/输出"接口,比如点亮一个LED.继电器等,或者通过iic spi 1-wire等协议,读取.写入数据,这都是G ...
- github--新手使用错误分析
先上去github 或者任意托管的网站.注册账号,新建仓库, 在本地运行Xcode 新建工程,新建工程的时候 勾上本地 的仓库,然后 在本地的项目根目录执行下边的命令: git remote add ...
- :last-child的诡异的问题!!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- WA(Write Amplification)写入放大
WA是闪存及SSD相关的一个极为重要的属性.由于闪存必须先擦除才能再写入的特性,在执行这些操作时,数据都会被移动超过1次.这些重复的操作不单会增加写入的数据量,还会减少闪存的寿命,更吃光闪存的可用带宽 ...
- 57. Spring 自定义properties升级篇【从零开始学Spring Boot】
之前在两篇文章中都有简单介绍或者提到过 自定义属性的用法: 25.Spring Boot使用自定义的properties[从零开始学Spring Boot] 51. spring boot属性文件之多 ...
- CDN库地址搜集2
常用开源库 http://open.bootcss.com/