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. 【GIS】ArcGIS JS 4.X

    require(["esri/Map", "esri/views/SceneView", "esri/TileLayer/TdtMapLayer/Td ...

  2. Python系统编程笔记

    01. 进程与程序 编写完毕的代码,在没有运行的时候,称之为程序 正在运行着的代码,就称为进程 进程是系统分配资源的最小单位. 进程资源包括: 中间变量 代码 计数器 02. 通过os.fork()函 ...

  3. iOS - UITabBarController中的坑

    当你创建一个继承与UITabBarController的子类 并想给其自定义构造方法 传一些值的时候这时候问题出现了: 在创建的时候里面的init方法回调用了 viewdidload,导致每次传值的时 ...

  4. Englis - 英文字母和音标

    英语学习基础基础是一切的根本 学习是一个长期积累知识的过程,正确掌握各科学习方法显得尤其重要!很多孩子学习成绩不好.记忆力不佳都是因为没有掌握正确的学习方法而造成的. 最基本的是:26个英文字母 48 ...

  5. 简单mysql类

    ---恢复内容开始--- class mysql { private $host; private $user; private $pass; private $database; private $ ...

  6. 从0开始:Windows内核利用的另一种方式

    https://www.anquanke.com/post/id/91063 从0开始:Windows内核利用的另一种方式 阅读量    9168 |   稿费 200   分享到: 发布时间:201 ...

  7. MongoDB安装问题以及启动

    在安装MongoDB的文件中找到bin文件,其中有mongo.exe应用程序,双击打开会出现第二幅图的样子. 将MongoDB服务器作为Windows服务运行,运行后,不知道为什么无法启动,即使删除d ...

  8. django rest framwork教程之 viewsets和routers

    ViewSets 和Routers REST框架包括一个用于抽象处理的ViewSets,允许开发人员集中精力对API的状态和交互进行建模,并根据常见约定自动处理URL构造. Viewset 类和 Vi ...

  9. [转载]ASP.NET伪静态页面的实现和伪静态在IIS7.0中的配置

    ASP.NET伪静态 UrlRewrite(Url重写) 实现和配置 最近在写一个CMS的内容管理系统,需要用到一个伪静态方面的方法,在网上找了一下这方面的资料,现将这方面的资源记录一下. 本机环境: ...

  10. 原生js(二)

    js的同步.异步和延迟 1.默认情况下,js是同步和阻塞DOM解析的.在解析DOM的过程中,当遇到script时,会暂停DOM解析,开始请求script并执行js,执行完成之后再接着解析DOM树. 2 ...