hdu 5660 暴力枚举
orz
![Image 1][]
jrMz有两种角,第一种角都是正nn边形的内角,第二种角都是正mm边形的内角。jrMz想选出其中一些,某种角可以选多个或一个都不选,使得选出的所有角的度数之和恰好为360度。
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <queue>
using namespace std ;
int main()
{
int t , n , m ;
scanf("%d",&t);
while(t--)
{
scanf("%d%d",&n,&m) ;
double angle1 = 180 * (n-2) / n ;
double angle2 = 180 * (m-2) / m ;
int ans = 0 ;
for(int i = 0 ; i <= 360 ; i++)
{
for(int j = 0 ; j <= 360 ; j++)
{
if((i*angle1+j*angle2)==360)
{
ans = 1 ;
break;
}
}
}
if(ans==1)puts("Yes");
else puts("No");
}
return 0 ;
}
[Image 1]:
还没有评论,来说两句吧...