HDU 3903 Trigonometric Function(数学定理)
Trigonometric Function
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 125536/65536 K (Java/Others)
Total Submission(s): 693 Accepted Submission(s): 277
Problem Description
Give you a triangle ABC. Get more information in the picture below.
Now, give you 6 integers a, b, c, n, m and k. a, b and c are triangle ABC`s three edges. Can you judge whether the result of the following fraction is rational number?
Input
There are several test cases in the input data.
Each case is just one line with 6 integers – a, b, c, n, m, k (0< a, b, c, n, m, k < 10^4) separated by spaces. The input data ensures that sin(kC) will not be equal with 0.
Output
Each case output “YES”, if the result of the fraction is rational number, otherwise “NO”.
Sample Input
2
1 1 1 1 1 1
3 4 5 6 7 7
Sample Output
NO
YES
若n为有理数,那么cos(n)一定是有理数
cos( k*n )一定是有理数
sin(n)确不一定。
所以只要判断分母是不是有理数就好了,sin(k*n)
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
#include <math.h>
#include <stdio.h>
using namespace std;
long long int a,b,c,n,m,k;
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
scanf("%lld%lld%lld%lld%lld%lld",&a,&b,&c,&n,&m,&k);
long long int num=4*a*a*b*b-(a*a+b*b-c*c)*(a*a+b*b-c*c);
long long int t=sqrt(1.0*num);
if(t*t==num)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
HDU 3903 Trigonometric Function(数学定理)的更多相关文章
- HDU 3903 Trigonometric Function
这题真难,并不会推理... #include<cstdio> #include<cstring> #include<cmath> #include<algor ...
- hdu 4651 Partition (利用五边形定理求解切割数)
下面内容摘自维基百科: 五边形数定理[编辑] 五边形数定理是一个由欧拉发现的数学定理,描写叙述欧拉函数展开式的特性[1] [2].欧拉函数的展开式例如以下: 亦即 欧拉函数展开后,有些次方项被消去,仅 ...
- 134. Gas Station(数学定理依赖题)
There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You ...
- 数学定理证明机械化的中国学派(II)
所谓"学派"是指:存在一帮人,具有同样或接近的学术观点或学术立场,採用某种特定的"方法"(或途径),在一个学术方向上共同开展工作.而且做出了相当有迎影响的学术成 ...
- HDU 6156 - Palindrome Function [ 数位DP ] | 2017 中国大学生程序设计竞赛 - 网络选拔赛
普通的数位DP计算回文串个数 /* HDU 6156 - Palindrome Function [ 数位DP ] | 2017 中国大学生程序设计竞赛 - 网络选拔赛 2-36进制下回文串个数 */ ...
- HDU 6050 - Funny Function | 2017 Multi-University Training Contest 2
/* HDU 6050 - Funny Function [ 公式推导,矩阵快速幂 ] 题意: F(1,1) = F(1, 2) = 1 F(1,i) = F(1, i-1) + 2 * F(1, i ...
- 2017ACM暑期多校联合训练 - Team 2 1006 HDU 6050 Funny Function (找规律 矩阵快速幂)
题目链接 Problem Description Function Fx,ysatisfies: For given integers N and M,calculate Fm,1 modulo 1e ...
- hdu 5105 Math Problem(数学)
pid=5105" target="_blank" style="">题目链接:hdu 5105 Math Problem 题目大意:给定a.b ...
- hdu 4704(费马小定理)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4704 思路:一道整数划分题目,不难推出公式:2^(n-1),根据费马小定理:(2,MOD)互质,则2^ ...
随机推荐
- c++const关键字---15
原创博文,转载请标明出处--周学伟 http://www.cnblogs.com/zxouxuewei/ const是一个C++语言的限定符,它限定一个变量不允许被改变.使用const在一定程度上可以 ...
- UnicodeEncodeError: ‘gbk’ codec can’t encode character u’\u200e’ in position 43: illegal multib
[问题] 在执行代码时,提示上述错误,源码如下: # 下载小说... def download_stoy(crawl_list,header): # 创建文件流,将各个章节读入内存 with open ...
- 【NodeJS】热更新
1.npm install -g supervisor 2.supervisor WellDetect.js
- Lua协程-测试3
print("Lua 协程测试3") -- 实现消费者-生产者关系(生产一个就消费一个) count = -- 生产总数 -- 生产者 local newProductorCo = ...
- Spring事务超时、回滚的相关说明
事务超时: @Transactional(timeout = 60) 如果用这个注解描述一个方法的话,线程已经跑到方法里面,如果已经过去60秒了还没跑完这个方法并且线程在这个方法中的后面还有涉及到对数 ...
- 使用Xcode自带的单元测试
今年苹果推出的iOS8和Swift的新功能让人兴奋.同时,苹果对于Xcode的测试工具的改进却也会影响深远.现在我们来看下XCTest,Xcode内置的测试框架.以及,Xcode6新增的XCTestE ...
- 对C#中几个循环语句的使用,请教
今天是在云和数据学院学习的第四天,由于各种原因···今天自己预习的循环语句的用法以及写了几个程序,也遇到各种的问题了···纠结.由于还是在学习的很初初初级,所以好多简单的方法还是不知道怎么写出来,只得 ...
- 【LeetCode OJ】Remove Element
题目:Given an array and a value, remove all instances of that value in place and return the new length ...
- 用Copy命令合并文件
用Copy命令合并文件 这个文章是在我以前的百度空间里面发表过的,后来因为某个内分泌失调的管理员把我的空间http://hi.baidu.com/kamdy 封了! 旧事不提,还是回到主题吧,这个 ...
- Android中Adapter总结
根据一个制作列表的程序开始练手,结果就出现了学习安卓的第一个代码问题 运行程序发现,虽然报错,但是可以成功运行程序. Android中Adapter功能为 显示ListView,最常用的有ArrayA ...