jrMz and angles
来源:互联网 发布:windows键盘option键 编辑:程序博客网 时间:2024/05/19 03:19
jrMz and angles
Accepts: 758
Submissions: 1198
Time Limit: 2000/1000 MS (Java/Others)
Memory Limit: 65536/65536 K (Java/Others)
Problem Description
jrMz has two types of angles, one type of angle is an interior angle of nnn-sided regular polygon, and the other type of angle is an interior angle of mmm-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)T\left(1\leq T\leq10\right)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)n,m\left(1\leq n,m\leq100\right)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.
水题:直接代码
#include<iostream>using namespace std;int main(){ int t,n,m; cin>>t; while(t--) { cin>>n>>m; int flag=1; double x=180-360.0/n,y=180-360.0/m; for(int i=0;i<=100;i++) { for(int j=0;j<100;j++) if(x*i+y*j==360) { cout<<"Yes"<<endl; //cout<<i<<" "<<j<<endl; flag=0; break; } if(!flag)break; } if(flag)cout<<"No"<<endl; } return 0;}
- jrMz and angles
- jrMz and angles
- HDU jrmz and angles
- jrMz and angles
- 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 (div.2)-jrMz and angles,,暴力求解~
- hdu 5660 jrMz and angles【暴力枚举】【水题】
- BestCoder Round #79 1001/hdu 5660 jrMz and angles
- HDU 5660/BC 79A jrMz and angles
- HDU 5560 jrMz and angles(简单暴力枚举)
- UVA 1643(p343)----Angles and Squares
- HDU 3879 Base Station 最小割
- 求助:python中深拷贝和浅拷贝的一道题目
- DDMS 连接真机,用file explore看不到data/data文件夹的解决办法
- mysqldump 导出数据库出错
- request请求路径
- jrMz and angles
- 使用Princeton(普利斯顿大学)的Java标准库的方法
- 最大子数组(C语言)
- LeetCode Best Time to Buy and Sell Stock II
- IBM RSA与EMF(一)
- leetcode刷题,总结,记录,备忘111
- KMP算法
- bzoj 1910: [Ctsc2002] Award 颁奖典礼 动态规划
- 算法:动态规划(新手勿喷)