Codeforces Round #652 (Div. 2) A. FashionabLee
程序员文章站
2022-04-30 22:48:32
...
A. FashionabLee
题目链接-A. FashionabLee
题目大意
给你一个正边(凸)多边形,当且仅当能旋转它,判断是否能使它至少有一条边平行于轴,并且至少有一条边同时平行于轴
解题思路
- 根据正方形(正四边形)可以推出,一个正多边形如果可以被相互垂直的两条对称轴分成相等的四份时,即可满足条件
- 所以只要该多边形边数是的倍数,即%,输出
- 具体操作见代码
附上代码
#pragma GCC optimize("-Ofast","-funroll-all-loops")
#include<bits/stdc++.h>
#define int long long
#define lowbit(x) (x &(-x))
#define endl '\n'
using namespace std;
const int INF=0x3f3f3f3f;
const int dir[4][2]={-1,0,1,0,0,-1,0,1};
const double PI=acos(-1.0);
const double e=exp(1.0);
const double eps=1e-10;
const int M=1e9+7;
const int N=2e5+10;
typedef long long ll;
typedef pair<int,int> PII;
typedef unsigned long long ull;
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--){
int n;
cin>>n;
if(n%4) cout<<"NO"<<endl;
else cout<<"YES"<<endl;
}
return 0;
}
上一篇: 二分法查找
下一篇: 二分法查找的java实现
推荐阅读
-
Codeforces Round #595 (Div. 3)D1D2 贪心 STL
-
Codeforces Round #655 (Div. 2) A. Omkar and Completion
-
Codeforces Round #487 (Div. 2)
-
Codeforces Round #649 (Div. 2)-B. Most socially-distanced subsequence(思维)
-
Codeforces Round #649 (Div. 2) C-Ehab and Prefix MEXs
-
Educational Codeforces Round 71 (Rated for Div. 2)E. XOR Guessing
-
Codeforces Round #659 (Div. 2) A. Common Prefixes(字符串,思维)
-
Codeforces Round #610 (Div. 2)
-
Codeforces Round #670 (Div. 2)
-
Codeforces Round #665 (Div. 2)