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. Track and Follow an Object----4

    原创博文:转载请标明出处(周学伟):http://www.cnblogs.com/zxouxuewei/tag/ ntroduction: 在本示例中,我们将探索包含Kinect摄像头的自主行为. 这 ...

  2. Disconf (version : 2.6.21)

    通常我们会做如下配置:(disconf 2.6.21) <!-- 一次扫描 --> <bean id="disconfMgrBean" class="c ...

  3. IIS------如何占用80端口

    如何占用80端口 请看我的一篇随笔: https://www.cnblogs.com/tianhengblogs/p/9292347.html

  4. virtio-netdev 数据包的发送

    在前面几文中已经大体介绍了virtio的重要组成,包含virtio net设备的创建,vring的创建,与virtio设备的交互方式,我们就从网络数据包的发送角度来看下virtio的详细使用流程. [ ...

  5. iOS 图片加载速度极限优化—FastImageCache解析

    FastImageCache是Path团队开发的一个开源库,用于提升图片的加载和渲染速度,让基于图片的列表滑动起来更顺畅,来看看它是怎么做的.优化点iOS从磁盘加载一张图片,使用UIImageVIew ...

  6. 【NLP】HanLP环境

    1.参考:https://github.com/hankcs/pyhanlp 2.问题: C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-u617cf ...

  7. PHP代码审计笔记--CSRF漏洞

    0x01 前言 CSRF(Cross-site request forgery)跨站请求伪造.攻击者盗用了你的身份,以你的名义向第三方网站发送恶意请求,对服务器来说这个请求是完全合法的,但是却完成了攻 ...

  8. python卸载或者安装时提示There is a problem with this Windows Installer package.A program required for this install to complete could not be run. Contact your support personnel or package vendor

    1.卸载时报这个错,先进行下修复,再执行卸载: 2.安装时报这个错,安装的过程中,没有取得管理员的权限. Msi格式的文件,点右键后,也没有“以管理员身份运行”的菜单项,那怎么办呢?你可以点“开始”菜 ...

  9. spring boot配置文件application.propertis

    转自http://www.qiyadeng.com/post/spring-boot-application-properties 本文记录Spring Boot application.proper ...

  10. shell编程(一)

    迷迷糊糊中发现了一个学习shell的非常好的教程,从头到尾看了一下,等看完全忘记了,没办法只能记录下来,教程网址http://c.biancheng.net/cpp/view/6994.html 以前 ...