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^ ...
随机推荐
- SQLServer转MYSQL的方法(连数据)[传]
转自 https://blog.csdn.net/AlbenXie/article/details/77449720 SQLServer转MYSQL的方法(连数据) 本次转换需要依赖使用工具Navic ...
- PHP导出excel文件的几种方式
PHP导出excel文件的几种方式 先说说动态生成的内容当作文件来下载的方法: 1.通过把Content-Type设置为application/octet-stream,可以把动态生成的内容当作文件来 ...
- 【GIS】ArcGIS JS 4.X
require(["esri/Map", "esri/views/SceneView", "esri/TileLayer/TdtMapLayer/Td ...
- 【DVWA】Web漏洞实战之File Upload
File Upload File Upload,即文件上传漏洞,一般的上传漏洞可能是未验证上传后缀 或者是验证上传后缀被bypass 或者是上传的文件验证了上传后缀但是文件名不重命名. LOW 直接上 ...
- Android--Led_Demo_APK控制LED灯
下面代码主要实现接口定义,实现从.so库文件接口函数在JAVA里面的声明:package com.friendlyarm.AndroidSDK; import android.util.Log; pu ...
- 用shell查找某目录下的最大文件
这是一个很有趣的问题,因为作为一个shell菜鸟,我第一时间是没有任何想法的.心里纳闷为什么这样的操作Linux居然没有直接的命令实现这样的查询. 很自然地,第一感觉就是用awk去实现,因为菜鸟我看a ...
- Matlab练习——素数查找
输入数字,0结束,判断输入的数字中的素数 clc; %清空命令行窗口的数据 clear; %清除工作空间的变量 k = ; n = ; %素数的个数 zzs(k) = input('请输入正整数: ' ...
- 使用IBM SVC构建vSphere存储间集群
使用IBM SVC构建vSphere存储间集群 本文目的 本文描述利用IBM SVC来构建Vsphere 存储间集群 解决方案 什么是vMSC? vShpere存储间集群是一个针对VmwarevSpe ...
- css笔记 - animation学习笔记(二)
animation动画 @keyframes规则 - 创建动画 from - to 等价于 0% - 100% 但是优先使用0% - 100%,因为浏览器兼容性还好点 animation 动画绑定 将 ...
- package.json字段全解(转)
Name 必须字段. 小提示: 不要在name中包含js, node字样: 这个名字最终会是URL的一部分,命令行的参数,目录名,所以不能以点号或下划线开头: 这个名字可能在require()方法中被 ...