jrMz and angles 暴力
来源:互联网 发布:淘宝怎么上货到店铺 编辑:程序博客网 时间:2024/05/19 03:27
jrMz and angles
Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
Submit
Status
Description
jrMz has two types of angles, one type of angle is an interior angle of
n
-sided regular polygon, and the other type of angle is an interior angle of
m
-sided regular polygon. jrMz wants to use them to make up an angle of 360 degrees, which means, jrMz needs to choose some or none of the angles which belong to the first type and some or none of the angles which belong to the second type so that the sum value of the angles chosen equals 360 degrees. But jrMz doesn’t know whether it is possible, can you help him?
Input
The first line contains an integer
T(1≤T≤10)
——The number of the test cases.
For each test case, the only line contains two integers
n,m(1≤n,m≤100)
with a white space separated.
Output
For each test case, the only line contains a integer that is the answer.
Sample Input
3
4 8
3 10
5 8
Sample Output
Yes
Yes
No
Hint
In test case 1, jrMz can choose 1 angle which belongs to the first type and 2 angles which belong to the second type, because 90+135+135=360. In test case 2, jrMz can choose 6 angles which belong to the first type, because6\times60=360. In test case 3, jrMz can’t make up an angle of 360 degrees.
思路 内角最小为60度 所以6个内角之内一定可以凑够360 1-6 遍历两个图形内角
//#include <bits/stdc++.h>#include <stdio.h>#include <iostream>#include <string.h>#include <stack>#include <algorithm>#include <queue>#include <map>#include <cmath>#define _int long longusing namespace std;int main(){ int t,flag; double angle1,angle2,n,m; cin>>t; while (t--) { cin>>n>>m; flag=1; angle1=(180.0*(n-2))/n; angle2=(180.0*(m-2))/m; for(int i=0;i<=6&&flag;i++) { for(int j=0;j<=6&&flag;j++) { if(i*angle1+j*angle2==360) { flag=0; } } } if (flag) { cout<<"No"<<endl; } else cout<<"Yes"<<endl; } return 0;}
- jrMz and angles 暴力
- jrMz and angles
- jrMz and angles
- HDU jrmz and angles
- jrMz and angles
- BestCoder Round #79 (div.2)-jrMz and angles,,暴力求解~
- hdu 5660 jrMz and angles【暴力枚举】【水题】
- HDU 5560 jrMz and angles(简单暴力枚举)
- BC-水题 jrMz and angles
- BC之jrMz and angles
- 【杭电】[5660]jrMz and angles
- 【HDU 5660】【水题】jrMz and angles
- 杭电5660 jrMz and angles
- hdu 5660 jrMz and angles(水题)
- bestcoder Round #79 (div.2)jrMz and angles
- BestCoder Round #79 1001/hdu 5660 jrMz and angles
- HDU 5660/BC 79A jrMz and angles
- UVA 1643(p343)----Angles and Squares
- Java语言中switch语句、用switch编写简单的计算器
- linux 下常用 svn 命令
- Javascript错误提示--SyntaxError: Illegal return statement
- 几句话讲清 JS 闭包
- Name node is in safe mode 解决办法
- jrMz and angles 暴力
- 优化加载和执行提高javascript性能
- MyBatis分页的简单实现
- 杭电5645之DZY Loves Balls
- 二叉搜索树的插入和删除结点操作以及iterator的构造
- SpringMVC个人零碎总结
- 手机浏览器上的特殊效果,如拨号、跳转地图app等
- HDOJ -- 1061 Rightmost Digi
- 1587 - Box