KIDx's Triangle

Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)

Problem Description

One day, KIDx solved a math problem for middle students in seconds! And than he created this problem.

Now, give you the degree of a, b, c, d, please calculate the degree of ∠AED.

Input

There are multiple test cases.

Each case contains one line 4 integers formatted as: "a b c d"

0 ≤ a, b, c, d < 90°.

0 < a+b < 90°, 0 < c+d < 90°.

Output

For each test case, output the answer in one line, rounded to 2 decimal places.

Sample Input

10 70 60 20
10 70 70 0

Sample Output

20.00
140.00
 #include<stdio.h>
#include<math.h>
#define pi 3.141592653589793
double a , b , c , d ;
double BE , BD , DE , bata , AD , AE ; inline double f (double k)
{
return 1.0 * k * pi / ;
} int main ()
{
freopen ("a.txt" , "r" , stdin ) ;
while (~ scanf ("%lf%lf%lf%lf" , &a , &b , &c , &d)) {
if (a == ) {
printf ("0.00\n") ;
continue ;
}
AD = sin (f(c)) / sin (f(a + b + c)) ;
BD = sin (f(c + d)) / sin (f(a + b + c + d)) - sin (f(c)) / sin (f(a + b + c)) ;
BE = sin (f(a + b)) / sin (f(a + b + c + d)) - sin (f(b)) / sin (f(b + c + d)) ; DE = sqrt (1.0 * (BE * BE + BD * BD + * BE * BD * cos (f(a + b + c + d)))) ;
AE = sin (f(c + d)) / sin (f(b + c + d)) ;
bata = acos (1.0 * (DE * DE + AE * AE - AD * AD) / (2.0 * DE * AE)) * / pi;
// printf ("DE = %.2f , EF = %.2f , DF = %.2f\n" , DE , EF , DF) ;
// printf ("bata = %.2f\n" , bata * 180 / pi) ;
if (bata < )
printf ("%.2f\n" ,180.0 - bata) ;
else
printf ("%.2f\n" , bata) ;
}
return ;
}

标程中的大写字母表示角度,小写字母表示边长,注意0的特殊情况即可。

设CE = a = 1,AE = b,AC = c,BE = d,AB = e,AD = f,BD = g,DE = h

使用正弦定理可依次求出AE,AB,AD

然后利用余弦定理依次求出DE,∠AED

其他解法:建立坐标系搞,或者二分搞

acdream.18.KIDx's Triangle(数学推导)的更多相关文章

  1. 数学 ACdream 1196 KIDx's Triangle

    题目传送门 /* 这道题花了好长时间AC,思路有,但是表达式少写了括号一直乱码,囧! 注意:a==0时要特判:) */ #include <cstdio> #include <alg ...

  2. 杭赛.Triangle(数学推导)

    Triangle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total S ...

  3. 借One-Class-SVM回顾SMO在SVM中的数学推导--记录毕业论文5

    上篇记录了一些决策树算法,这篇是借OC-SVM填回SMO在SVM中的数学推导这个坑. 参考文献: http://research.microsoft.com/pubs/69644/tr-98-14.p ...

  4. 关于不同进制数之间转换的数学推导【Written By KillerLegend】

    关于不同进制数之间转换的数学推导 涉及范围:正整数范围内二进制(Binary),八进制(Octonary),十进制(Decimal),十六进制(hexadecimal)之间的转换 数的进制有多种,比如 ...

  5. 模拟 ACdream 1196 KIDx's Pagination

    题目传送门 /* 简单模拟:考虑边界的情况输出的是不一样的,还有思维好,代码能短很多 */ #include <cstdio> #include <iostream> #inc ...

  6. UVA - 10014 - Simple calculations (经典的数学推导题!!)

    UVA - 10014 Simple calculations Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & ...

  7. 『sumdiv 数学推导 分治』

    sumdiv(POJ 1845) Description 给定两个自然数A和B,S为A^B的所有正整数约数和,编程输出S mod 9901的结果. Input Format 只有一行,两个用空格隔开的 ...

  8. LDA-线性判别分析(二)Two-classes 情形的数学推导

    本来是要调研 Latent Dirichlet Allocation 的那个 LDA 的, 没想到查到很多关于 Linear Discriminant Analysis 这个 LDA 的资料.初步看了 ...

  9. leetcode 343. Integer Break(dp或数学推导)

    Given a positive integer n, break it into the sum of at least two positive integers and maximize the ...

随机推荐

  1. virtualbox 打不开ubuntu解决

    装了一个win7x64,准备打开ubuntu12.04,后来竟然报错(最新版的virtualbox,VirtualBox-4.3.18-96516-Win): 也没找到什么原因,网上查了之后,禁用了w ...

  2. CMD命令下对文件夹进行权限处理 转

    保证自己的磁盘分区格式是NTFS.FAT32是不行的. 一.Cacls.exe命令的使用 这是一个在Windows 2000/XP/Server 2003操作系统下都可以使用的命令,作用是显示或者修改 ...

  3. Android响应式界面开发要点

    现在很多项目需要到达同一个Apk既可以在Phone上跑也尅在tablet上跑,即界面要适应不同尺寸和类型的需要而自动调整.这个即为响应式设计.在web开发商响应式设计已经是个常谈的内容了,而对于and ...

  4. 【MPI学习3】MPI并行程序设计模式:不同通信模式MPI并行程序的设计

    学习了MPI四种通信模式 及其函数用法: (1)标准通信模式:MPI_SEND (2)缓存通信模式:MPI_BSEND (3)同步通信模式:MPI_SSEND (4)就绪通信模式:MPI_RSEND ...

  5. please tell me the error about java Graphics

    this is the code: public class paint extends JFrame{ public paint(){ setLayout(new FlowLayout()); se ...

  6. 2016 版 Laravel 系列入门教程(一)【最适合中国人的 Laravel 教程】

    本教程示例代码见: https://github.com/johnlui/Learn-Laravel-5 在任何地方卡住,最快的办法就是去看示例代码. 本文基于 Laravel 5.2 版本,无奈 5 ...

  7. “耐撕”团队2016.04.14站立会议

    1. 时间 : 19:20--19:40  共计20分钟 2. 人员 : Z   郑蕊 * 组长 (博客:http://www.cnblogs.com/zhengrui0452/), P 濮成林(博客 ...

  8. Eclipse自动生成UML图(转载)

    *ModelGoon是什么? 它是一个Eclipse插件,用于基于UML图的模型设计,以及逆向工程(即从已有源代码生成类图等,以作为代码分析或者文档使用). *适用条件 ModelGoon目前最新的版 ...

  9. 替换文件最后一行中的所有e 为 E

    #root@athena5plus:~# cat b    northwest       NW     Charles Main           3.0      .98      3      ...

  10. 【POJ 2250】Compromise(最长公共子序列LCS)

    题目字符串的LCS,输出解我比较不会,dp的时候记录从哪里转移来的,之后要一步一步转移回去把解存起来然后输出. #include<cstdio> #include<cstring&g ...