Codeforces Round #651 (Div. 2) 參與排名人數14559
[codeforces 1369A] FashionabLee 正多邊形
總目錄詳見https://blog.csdn.net/mrcrack/article/details/103564004
在線測評地址http://codeforces.com/contest/1369/problem/A
Problem | Lang | Verdict | Time | Memory |
---|---|---|---|---|
A - FashionabLee | GNU C++17 | Accepted | 31 ms | 3600 KB |
題目大意:給定一個正多邊形,放置於平面直角座標系的第一象限,若能做到一條邊與x軸平行的同時,另一條邊能與y軸平行的同時,輸出YES,否則輸出NO。
第一發WA,按奇偶進行判定,之後仔細畫圖,才發現,符合題意的多邊形,邊數必須是4的整數倍。
AC代碼如下:
#include <stdio.h>
int main(){
int t,n;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
if(n%4)printf("NO\n");
else printf("YES\n");
}
return 0;
}