You are given two integers nn and mm (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).
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.
The first line of the input contains one integer tt (1≤t≤1041≤t≤104) — the number of test cases.
The next tt lines describe test cases. Each test case is given as two space-separated integers nn and mm (3≤m<n≤1003≤m<n≤100) — the number of vertices in the initial polygon and the number of vertices in the polygon you want to build.
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.
2 6 3 7 3
YES
m能整除n的话就行,能满足对称性。
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; int n,m; while(t--) { cin>>n>>m; if(n%m==0) { cout<<"YES"<<endl; } else cout<<"NO"<<endl; } return 0; }