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(数学定理)的更多相关文章

  1. HDU 3903 Trigonometric Function

    这题真难,并不会推理... #include<cstdio> #include<cstring> #include<cmath> #include<algor ...

  2. hdu 4651 Partition (利用五边形定理求解切割数)

    下面内容摘自维基百科: 五边形数定理[编辑] 五边形数定理是一个由欧拉发现的数学定理,描写叙述欧拉函数展开式的特性[1] [2].欧拉函数的展开式例如以下: 亦即 欧拉函数展开后,有些次方项被消去,仅 ...

  3. 134. Gas Station(数学定理依赖题)

    There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You ...

  4. 数学定理证明机械化的中国学派(II)

    所谓"学派"是指:存在一帮人,具有同样或接近的学术观点或学术立场,採用某种特定的"方法"(或途径),在一个学术方向上共同开展工作.而且做出了相当有迎影响的学术成 ...

  5. HDU 6156 - Palindrome Function [ 数位DP ] | 2017 中国大学生程序设计竞赛 - 网络选拔赛

    普通的数位DP计算回文串个数 /* HDU 6156 - Palindrome Function [ 数位DP ] | 2017 中国大学生程序设计竞赛 - 网络选拔赛 2-36进制下回文串个数 */ ...

  6. 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 ...

  7. 2017ACM暑期多校联合训练 - Team 2 1006 HDU 6050 Funny Function (找规律 矩阵快速幂)

    题目链接 Problem Description Function Fx,ysatisfies: For given integers N and M,calculate Fm,1 modulo 1e ...

  8. hdu 5105 Math Problem(数学)

    pid=5105" target="_blank" style="">题目链接:hdu 5105 Math Problem 题目大意:给定a.b ...

  9. hdu 4704(费马小定理)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4704 思路:一道整数划分题目,不难推出公式:2^(n-1),根据费马小定理:(2,MOD)互质,则2^ ...

随机推荐

  1. 【Postgres】dump数据库备份与还原

    备份 pg_dump.exe -h localhost -p 5432 -U postgres -F plain -v -f C:\Backup.sql db1 2> C:\Backup.log ...

  2. Maven 多项目依赖,需要验证artifact的output root中是否包含其他项目输出

  3. Spring getBean 首字母大小写问题

    如果类第一个字母大写第二个小写,那么首字母小写获取bean 如果第一个和第二个字母都是大写的,那个获取bean首字母要大写

  4. 【转载】浅谈TDD、BDD与ATDD软件开发

    转载自(此处仅供学习):http://blog.csdn.net/zhenyu5211314/article/details/22033295 1. 首先了解一下这三个开发模式都是什么意思: TDD: ...

  5. ARM入门最好的文章

    一 首先说说arm的发展  可以用一片大好来形容,翻开各个公司的网站,招聘里面嵌入式占据了大半工程师职位.广义的嵌入式无非几种:传统的什么51.avr.pic称做嵌入式微控制器:arm是嵌入式微处理器 ...

  6. Lua 正确的尾调用(proper tail call)

    Lua支持“尾调用消除(tail-call elimination)”.尾调用(tail call):当一个函数调用是另一个函数的最后一个动作时,该调用才算是一条“尾调用”.例如,下面的代码就是一条“ ...

  7. iOS - UITextView在调用textViewDidChange方法,九宫格相关中文输入的问题

    问题一 iOS textView在调用 UITextViewDelegate 的 textViewDidChange方法,九宫格相关中文输入的问题 有时候,需要在textViewDidChange处理 ...

  8. Andoid数据存储之SQLite数据库

    SQLite是一个嵌入式的并且是一个轻量级的数据库: SQLite数据库支持大部分SQL语法, 允许使用SQL语句操作数据库, 其本质是一个文件, 不需要安装启动: SQLite数据库打开只是打开了一 ...

  9. 基础知识《十二》一篇文章理解Cookie和Session

    理解Cookie和Session机制 会话(Session)跟踪是Web程序中常用的技术,用来跟踪用户的整个会话.常用的会话跟踪技术是Cookie与Session.Cookie通过在客户端记录信息确定 ...

  10. PHP域名解析(一个IP绑多域名)----看看可以,并不值得借鉴

    PHP域名解析(一个IP绑多域名)----看看可以,并不值得借鉴 好处当然是不用买多网卡.不用设置其它端口为WEB端口了,一张网卡上.都用同一个80端口建很多网站. 假设有三个域名:     [url ...