
Axial symmetry FZU - 2035
������������������������������������������������������������������������������������������������ ��������������������������������������������������������������������������������������������������������������������������� ������������������ ���������������������������������������������������������������������������x������y������ ������ ������������������������������������������������������������ ��������������������������������������������������������������������������������������������������� ���������������������������������������������������������������������������������������������������
发布日期:2021-05-10 18:38:58
浏览次数:16
分类:精选文章
本文共 3481 字,大约阅读时间需要 11 分钟。
������������������������������������������������������������������������������������������������������������������������������������������������x���������������������y������������������������������������������������������������������������
������������
- ���������������������������������������������������������������������������������������������
- ������������������������������������������������������������������������������������
������������
#include#include #include using namespace std;bool equ(double x1, double y1, double x2, double y2) { return (abs(x1 - x2) < 0.0000001 && abs(y1 - y2) < 0.0000001);}int main() { int t; int cas = 1; scanf("%d", &t); while (t--) { int n; scanf("%d", &n); struct Node { double x, y; Node(double x = 0, double y = 0) : x(x), y(y) {} }; Node node[N]; for (int i = 0; i < n; ++i) { scanf("%lf%lf", &node[i].x, &node[i].y); } node[n] = node[0]; int total_points = 2 * n; Node *points = new Node[total_points]; int count = 0; for (int i = 0; i <= n; ++i) { points[count++] = node[i]; double mid_x = (node[i].x + node[(i + 1) % n].x) / 2; double mid_y = (node[i].y + node[(i + 1) % n].y) / 2; points[count++] = {mid_x, mid_y}; } bool flag = false; for (int i = 0; i < n; ++i) { if (equ(points[i].x, points[i].y, points[i + n].x, points[i + n].y)) { bool ok = true; for (int j = 1; j < n; ++j) { int a = (i + j); int b = (i - j + 2 * n) % total_points; int a2 = (i + j + n) % total_points; int b2 = (i - j + 2 * n) % total_points; Point p1 = points[a]; Point p2 = points[b]; Point p3 = points[a2]; Point p4 = points[b2]; if (!equ((p1.x + p2.x) / 2, (p1.y + p2.y) / 2, points[i].x, points[i].y) || !equ(p1.x, p1.y, p3.x, p3.y) || !equ(p2.x, p2.y, p4.x, p4.y)) { ok = false; break; } } if (ok) { flag = true; break; } } } if (flag) { printf("Case %d: YES\n", cas++); } else { printf("Case %d: NO\n", cas++); } } return 0;}
������������
equ
������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
发表评论
最新留言
逛到本站,mark一下
[***.202.152.39]2025年04月11日 18时33分02秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
Permission denied 解决方案
2021-05-10
iOS_Runtime3_动态添加方法
2021-05-10
Docker配置文件
2021-05-10
PNFT邮票数字资产化,科技、美学与价值的完美融合
2021-05-10
Leetcode第557题---翻转字符串中的单词
2021-05-10
IDEA:修改编辑区背景色
2021-05-10
C# WinForm 圆角button
2021-05-10
Problem G. The Stones Game【取石子博弈 & 思维】
2021-05-10
HRBUST—1891 A + B Problem VII
2021-05-10
框架综合实践(3)-业务逻辑businessView的封装
2021-05-10
Robot Framework 新建资源文件-用户关键字
2021-05-10
HDU - 2732 Leapin‘ Lizards 拆点最大流+BFS 学好英语QAQ
2021-05-10
java数组初始化及内存分析
2021-05-10
Unable to execute dex: Multiple dex files
2021-05-10
3分钟搞懂js的冒泡和捕获?
2021-05-10
Mac电脑调用自带的命令行窗口
2021-05-10
终端查看本机ip地址
2021-05-10
vue前端导出多级表头的excel表
2021-05-10