hdu 5660 jrMz and angles(水题)
来源:互联网 发布:微信有变声软件吗 编辑:程序博客网 时间:2024/05/17 07:32
Problem 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 integersn,m(1≤n,m≤100) with a white space separated.
For each test case, the only line contains two integers
Output
For each test case, the only line contains a integer that is the answer.
Sample Input
34 83 105 8
Sample Output
YesYesNo
solution:
给你两个正多边形的边数,问你这两个正多边形内角的组合能否组成360,小模拟。
#include<cstdio>#include<cstring>#include<cmath>#include<algorithm>#include<map>#include<queue>#include<stack>#include<string>#include<iostream>#include<set>using namespace std;typedef long long ll;#define mem(a) (memset(a,0,sizeof(a)))#define f0(x,n) for(int x=0;x<n;x++)#define f1(x,n) for(int x=1;x<=n;x++)#define si(x) scanf("%d",&x)#define sii(x,y) scanf("%d%d",&x,&y)#define siii(x,y,z) scanf("%d%d%d",&x,&y,&z)#define sl(x) scanf("%I64d",&x)#define sll(x,y) scanf("%I64D%I64d",&x,&y)#define sd(x) scanf("%lf",&x)#define sdd(x,y) scanf("%lf%lf",&x,&y)#define mp(x,y) make_pair(x,y)#define pb(x) push_back(x)const int maxn = 1e6 + 500;const int inf = 1e9 + 7;int n,m;int main(){ int t; si(t); while (t--) { scanf("%d%d", &n, &m); n = 180 * (n - 2) / n, m = 180 * (m - 2) / m; int f = 0; if (360 % n == 0 || 360 % m == 0)f = 1; else { int ans = 360; while (ans >= n) { ans -= m; if (ans%n == 0){ f = 1; break; } } } if (f)printf("Yes\n"); else printf("No\n"); } return 0;}
0 0
- 【HDU 5660】【水题】jrMz and angles
- hdu 5660 jrMz and angles(水题)
- HDU jrmz and angles
- hdu 5660 jrMz and angles【暴力枚举】【水题】
- BC-水题 jrMz and angles
- BestCoder Round #79 1001/hdu 5660 jrMz and angles
- HDU 5660/BC 79A jrMz and angles
- 【杭电】[5660]jrMz and angles
- 杭电5660 jrMz and angles
- jrMz and angles
- jrMz and angles
- jrMz and angles
- jrMz and angles 暴力
- HDU 5560 jrMz and angles(简单暴力枚举)
- BC之jrMz and angles
- bestcoder Round #79 (div.2)jrMz and angles
- BestCoder Round #79 (div.2)-jrMz and angles,,暴力求解~
- UVA 1643(p343)----Angles and Squares
- iw工具安装和使用
- 第九周项目 1.1 补全注释
- sprintf( char *buffer, const char *format, [ argument] … );用法详解
- BestCoder Round #81 (div.1) A Matrix
- 数据结构:多叉树的建立
- hdu 5660 jrMz and angles(水题)
- C语言基础及数据类型
- 专题二 · 1024
- win7_64bits下QT试用openCV库(1)
- 11(线程)
- C陷阱与缺陷学习笔记
- OD调试一个小程序的思考总结
- 344. Reverse String
- 怎么用css去掉chrome浏览器中input获得焦点时的带颜色边框呢