Codeforce1312A --Two Regular Polygons

Codeforce 1312A Two Regular Polygons

题目

You are given two integers n and m (m<nm<n). Consider a convex regular polygon of nn vertices. Recall that a regular polygon is a polygon that is equiangular (all angles are equal in measure) and equilateral (all sides have the same length).
Examples of convex regular polygons

Your task is to say if it is possible to build another convex regular polygon with mm vertices such that its center coincides with the center of the initial polygon and each of its vertices is some vertex of the initial polygon.

You have to answer tt independent test cases.


Input

The first line of the input contains one integer t (1≤t≤104) — the number of test cases.

The next tt lines describe test cases. Each test case is given as two space-separated integers n and m (3≤m<n≤100) — the number of vertices in the initial polygon and the number of vertices in the polygon you want to build.


Output

For each test case, print the answer — “YES” (without quotes), if it is possible to build another convex regular polygon with mm vertices such that its center coincides with the center of the initial polygon and each of its vertices is some vertex of the initial polygon and “NO” otherwise.


Sample Input

2
6 3
7 3

Sample Output

YES
NO

题目大意:
告诉你正多边行的边数和内接的正多边形的边数,让你判断,能不能满足,内接的正多边形都是以外面的多边形的顶点为顶点

题目分析:
这个是div.2里少有的水题,开始我还想错了,以为只有偶数边才可以,但后来发现,只要外面的边数可以被里面的整除就好了

AC代码

#include<stdio.h>
int n,m,t;
int main(){
	scanf("%d",&t);
	while(t--){
		scanf("%d%d",&n,&m)
			if(n%m==0)
			printf("YES\n");
			else
			printf("NO\n");
	}
	return 0;
}
发布了50 篇原创文章 · 获赞 50 · 访问量 2735

猜你喜欢

转载自blog.csdn.net/weixin_45691686/article/details/104784704
two