HDU-2552 三足鼎立
三足鼎立
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1818 Accepted Submission(s): 988
可惜辽誓不甘心,辽国征南大将军<耶律javac++>欲找出三人所在逐个击破,现在他发现威士忌的位置s,天外来客的位置u,不过很难探查到亦纷菲v所在何处,只能知道三人满足关系:
arctan(1/s) = arctan(1/u)+arctan(1/v)
注:
(其中0 <= x <= 1) 定义 f(s, u, v) = v*u-s*u-s*v 的值 为<三足鼎立><耶律javac++>想计算<三足鼎立>的值
比如:答案是1.7 则输出 1
1 #include<stdio.h>
#include<math.h>
int main()
{
int a;
double b,c,s,u,v,t,g;
scanf("%d",&a);
while(a--)
{
scanf("%lf%lf",&b,&c);
s=atan(/b);
u=atan(/c);
v=s-u;
t=tan(v);
t=/t;
g=t*c-b*c-b*t;
printf("%.0lf\n",g);
} return ;
}
二:运用公式做法:
/*1.tan(a+b) = ( tan(a) + tan(b) ) / (1 – tan(a) * tan(b) )
2.tan( atan(x) ) = x
arctan(1/s) = arctan(1/u)+arctan(1/v) 所以得1/s = tan( arctan(1/u)+arctan(1/v) ) = (tan(arctan(1/u)) + tan(arctan(1/v)))/(1-tan(arctan(1/u))*tan(arctan(1/v))) = (1/u + 1/v) / (1 - 1/(uv))
所以解得 uv = 1 + us + vs*/
#include<stdio.h>
int main()
{
int t,s,u;
scanf("%d",&t);
while(t--)
{
scanf("%d%d",&s,&u);
printf("1\n");
}
}
HDU-2552 三足鼎立的更多相关文章
- HDOJ/HDU 2552 三足鼎立(tan()和atan()方法)
Problem Description MCA山中人才辈出,洞悉外界战火纷纷,山中各路豪杰决定出山拯救百姓于水火,曾以题数扫全场的威士忌,曾经高数九十九的天外来客,曾以一剑铸十年的亦纷菲,歃血为盟,盘 ...
- HDU 2552 三足鼎立(数学函数)
/* <耶律javac++>欲找出三人所在逐个击破, 现在他发现威士忌的位置s,天外来客的位置u, 不过很难探查到亦纷菲v所在何处,只能知道三人满足关系: arctan(1/s) = ar ...
- 推公式 HDU 2552
T 给你2个值 求另外一个 需要推一下 tan(a+b)=(tan(a)+tan(b))/(1-tan(a)*tan(b)); 等式左右取tan tan(atan(a))=a 1/s=tan(...) ...
- HDU——PKU题目分类
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...
- [转] HDU 题目分类
转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008 ...
- HDU ACM 题目分类
模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 104 ...
- HDU 5643 King's Game 打表
King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...
- 转载:hdu 题目分类 (侵删)
转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
随机推荐
- c# linq 基础知识点
1.Where与TakeWhile,Where和sql中的where一样,返回所有满足条件的元素,而TakeWhile判断原理类似于while语句,从头逐个判断,只要条件为真就一直返回检索到的元素,只 ...
- 第3章 Struts2框架--1、Struts2环境搭建
第3章 Struts2框架--1.Struts2环境搭建 搭建步骤: 1.从下载http://struts.apache.org 没找到Struts2.3.16版,就下载了2.3.29 2.拷贝后解压 ...
- windows下ipython的tab补全,只需安装pyreadline即可.
运行ipython提示缺失模块 在windows下安装readline失败. 根据提示访问 https://urllib3.readthedocs.org/en/latest/security.htm ...
- HDU 1619 Unidirectional TSP(单向TSP + 路径打印)
Unidirectional TSP Problem Description Problems that require minimum paths through some domain appea ...
- Matlab网格划分
之前转载了一篇博客http://blog.sina.com.cn/s/blog_6163bdeb0102dvay.html,讲Matlab网格划分程序Distmesh,看了看程序,感觉程序写得有很多值 ...
- IF EXIST: The syntax of the command is incorrect.
Batch 脚本中使用 IF EXIST 语句时,总是提示 The syntax of the command is incorrect. 原始 bat 脚本如下: ECHO OFF SET proj ...
- 九度OJ 1108 堆栈的使用
题目地址:http://ac.jobdu.com/problem.php?pid=1108 题目描述: 堆栈是一种基本的数据结构.堆栈具有两种基本操作方式,push 和 pop.Push一个值会将其压 ...
- js生成随机字符串或者随机数
//返回一个指定范围内的随机数 function createRandomNum(Min,Max){ let Range = Max - Min; let Rand = Math.random(); ...
- yii2源码学习笔记(十二)
继续了解controller基类. /** * Runs a request specified in terms of a route.在路径中指定的请求. * The route can be e ...
- xcode 自动添加注释,生成文档
一.自动生成注释代码 添加一个快捷键,生成 注释代码 ThisService 下载连接:http://wafflesoftware.net/thisservice/ ...