Codeforce 270A - Fancy Fence (正多边形)
Emuskald needs a fence around his farm, but he is too lazy to build it himself. So he purchased a fence-building robot.
He wants the fence to be a regular polygon. The robot builds the fence along a single path, but it can only make fence corners at a single angle a.
Will the robot be able to build the fence Emuskald wants? In other words, is there a regular polygon which angles are equal to a?
The first line of input contains an integer t (0 < t < 180) — the number of tests. Each of the following t lines contains a single integer a(0 < a < 180) — the angle the robot can make corners at measured in degrees.
For each test, output on a single line "YES" (without quotes), if the robot can build a fence Emuskald wants, and "NO" (without quotes), if it is impossible.
3
30
60
90
NO
YES
YES
In the first test case, it is impossible to build the fence, since there is no regular polygon with angle .
In the second test case, the fence is a regular triangle, and in the last test case — a square.
题解:看是否能构成正多边形
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
const int N=;
const int mod=1e9+;
int main()
{
std::ios::sync_with_stdio(false);
int t;
cin>>t;
while(t--){
int n;
cin>>n;
if(%(-n)==) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
return ;
}
Codeforce 270A - Fancy Fence (正多边形)的更多相关文章
- 【Henu ACM Round#20 A】 Fancy Fence
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 看看有没有(n-2)*180/n等于输入的a就好. [代码] #include <bits/stdc++.h> usin ...
- ACM Color the fence
Color the fence 时间限制:1000 ms | 内存限制:65535 KB 难度:2 描述 Tom has fallen in love with Mary. Now Tom w ...
- [LeetCode] Paint Fence 粉刷篱笆
There is a fence with n posts, each post can be painted with one of the k colors. You have to paint ...
- UVA 12300 Smallest Regular Polygon(正多边形)
题意:给出两点,求经过这两点的正n边形的最小面积 题解:这两点一定是最长的弦,我们设正多边形中点c,找到c到每个点的距离(都相同) 我们知道那个等腰三角形的底与每个角度就使用余弦定理 #include ...
- poj 3253 Fence Repair
Fence Repair Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 42979 Accepted: 13999 De ...
- CF 484E - Sign on Fence
E. Sign on Fence time limit per test 4 seconds memory limit per test 256 megabytes input standard in ...
- poj3253 Fence Repair
http://poj.org/problem?id=3253 Farmer John wants to repair a small length of the fence around the pa ...
- CF448C Painting Fence (分治递归)
Codeforces Round #256 (Div. 2) C C. Painting Fence time limit per test 1 second memory limit per tes ...
- Codeforces Round #276 (Div. 1) E. Sign on Fence 二分+主席树
E. Sign on Fence Bizon the Champion has recently finished painting his wood fence. The fence consi ...
随机推荐
- dwr的ScriptSession和HttpSession分析
1.关于ScriptSession ScriptSession不会与HttpSession同时创建 当我们访问一个页面的时候,如果是第一次访问,会创建一个新的HttpSession,之后再访问的时候, ...
- navicat如何导出mysql数据表结构
我们在创建数据库时会对字段进行设置,比如类型.长度等,如果字段多的话一个个设置非常麻烦,可以从其他地方已有的表导入数据表结构,怎么操作呢?我们拿navicat导出mysql数据表结构为例: 1.点击“ ...
- python读、写、修改、追写excel文件
三个工具包 python操作excel的三个工具包如下 xlrd: 对excel进行读相关操作 xlwt: 对excel进行写相关操作 xlutils: 对excel读写操作的整合 注意,只能操作.x ...
- MySQL5.7配置基于GTID的复制
MySQL5.7下配置GTID复制的方法: 修改主库和从库的配置文件,加入下列部分的配置项:主库:[mysqld]log-bin=mysql-binbinlog_format= ROWgtid-mod ...
- TADOConnection组件
该组件用于建立数据库的连接.ADO的数据源组件和命令组件可以通过该组件运行命令及数据库中提取数据等. 该组件用于建立数据库的连接,该连接可被多个数据集所共享,但是并不是应用程序中必须的,因为ADO数据 ...
- [php] 索引数组合并选择两数组相加
header("Content-Type:text/html;charset=utf-8");$arr1= Array ( 0 => Array ( 'pic' => ...
- boost生成json中的put操作
ptree中的put操作后可以加<>,指定类型,不加<>采用默认的类型,感觉不加反而更好用.用法见下面例子. #include <iostream> #includ ...
- Scala常用变量生命周期
val words = *** //在words被定义时取值 lazy val words = *** //在words被首次使用时取值 def words = *** //在每一次words被使用时 ...
- HTTP协议和WEB框架
一.HTTP协议 <<HTTP权威指南>>读书笔记:https://www.cnblogs.com/qcssmd/p/5508150.html 一.HTTP简介 HTTP协议是 ...
- 二叉树df
二叉树 最有搜索算法 打印偶节点 不要用递归