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. 倒戈了,转投简书 -------->

    深情自白 还记得数月前那个月黑风高的晚上,笔主偶遇简书,被那婀娜多姿的Markdown输出深深吸引不能自拔,从此立下毒誓要两边同时发布.然而天有不测风云(这边的太丑),前思后想寝食难安之后作出决定,正 ...

  2. swift项目实战FoodPin目录

    好吧,据说写博客能够找到好工作,那我也来分享一个项目吧! 自己自学iOS开发也有半年多了,现在就来分享一个swift的小项目吧!这个项目的来源是<Beginning iOS8 programmi ...

  3. 编译到底做了什么(***.c -> ***.o的过程)

     (第一次写博客,好激动的说.......)   我们知道,一个程序由源代码到可执行文件往往由这几步构成: 预处理(Prepressing)-> 编译(Compilation)-> 汇编( ...

  4. Java 读取文件到字符串

    Java的io操作比较复杂 package cn.outofmemory.util; import java.io.BufferedReader; import java.io.FileInputSt ...

  5. Nginx 配置详解

    http://www.cnblogs.com/analyzer/articles/1377684.html 本文转自:http://blog.c1gstudio.com/archives/434 推荐 ...

  6. oracle-7参数文件的管理

    参数文件的管理:1.参数文件的作用:记录数据库的配置的 (1)pfile  ---> 文本文件 (2)spfile --->服务器的参数文件(二进制的) 两个参数文件的区别: pfile ...

  7. poj2763 树链剖分(线段树)

    注意这里都是把边放到线段树中,所以lca的时候,要注意如果top[x]==top[y] && x==y 的时候已经完成了. 仔细想想边和点的不同之处!!! #include<ma ...

  8. 43.Android之ListView中BaseAdapter学习

    实际开发中个人觉得用的比较多是BaseAdapter,尽管使用起来比其他适配器有些麻烦,但是使用它却能实现很多自己喜欢的列表布局,比如ListView.GridView.Gallery.Spinner ...

  9. bzoj 1791 DP

    首先对于一棵树我们可以tree_dp来解决这个问题,那么对于环上每个点为根的树我们可以求出这个树的一端为根的最长链,并且在tree_dp的过程中更新答案.那么我们对于环,从某个点断开,破环为链,然后再 ...

  10. Memory Allocation API In Linux Kernel && Linux Userspace、kmalloc vmalloc Difference、Kernel Large Section Memory Allocation

    目录 . 内核态(ring0)内存申请和用户态(ring3)内存申请 . 内核态(ring0)内存申请:kmalloc/kfree.vmalloc/vfree . 用户态(ring3)内存申请:mal ...