Codeforces Round #652 (Div. 2) A. FashionabLee(几何)

题目链接:https://codeforces.com/contest/1369/problem/A

题意

判断正 $n$ 边形能否通过旋转使得一边与 $x$ 轴平行,一边与 $y$ 轴平行。

题解

符合条件的正 $n$ 边形一定可以像正方形一样被两个对称轴 $4$ 等分,即总的边数为 $4$ 的倍数。 

代码

#include <bits/stdc++.h>
using namespace std;

void solve() {
    int n; cin >> n;
    cout << (n % 4 == 0 ? "YES" : "NO") << "\n";
}

int main() {
    int t; cin >> t;
    while (t--) solve();
}

猜你喜欢

转载自www.cnblogs.com/Kanoon/p/13189109.html
今日推荐