博客
关于我
D. Timofey and rectangles[四色定理]
阅读量:529 次
发布时间:2019-03-08

本文共 963 字,大约阅读时间需要 3 分钟。

关于, 和歌德巴赫猜想/ 费马大定理 为数学3大数学 猜想 之一,由某大学生提出

题意:给n个矩形的坐下角坐标和右上角坐标.问如何染色(四种颜色),使得相邻矩形颜色不同

思路: 一定有解

1) 对左下角坐标进行讨论

坐标 颜色(任意一种排序)
奇偶 1
偶奇 2
偶偶 3
奇奇 4

如果左下角为奇偶,那么左下角还是奇偶的就一定不会和这个矩形相邻(画图证明四个角的坐标奇偶性)

#include
#define PI acos(-1.0)#define pb push_back#define F first#define S second#define debug puts#define setp cout << fixed << setprecision(15)#define FAST_IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);using namespace std;typedef long long ll;const int N=2e3+3;const int MOD=998244373;//ll rain[N],dp[N],u[N];int main(void){ FAST_IO;// cout << -1%2 << endl; int n; cin >> n; cout <<"YES"<
>a >> b >> c >> d; if(a<0) a=-a; if(b<0) b=-b; if(c<0) c=-c; if(d<0) d=-d; if(a%2==1&&b%2==1) cout << 1 << endl; else if(a%2==1&&b%2==0) cout << 2 << endl; else if(a%2==0&&b%2==0) cout << 3 << endl; else if(a%2==0&&b%2==1) cout << 4 << endl; } return 0;}/********50267*********/

转载地址:http://uykiz.baihongyu.com/

你可能感兴趣的文章
Manjaro 24.1 “Xahea” 发布!具有 KDE Plasma 6.1.5、GNOME 46 和最新的内核增强功能
查看>>
mapping文件目录生成修改
查看>>
MapReduce程序依赖的jar包
查看>>
mariadb multi-source replication(mariadb多主复制)
查看>>
MariaDB的简单使用
查看>>
MaterialForm对tab页进行隐藏
查看>>
Member var and Static var.
查看>>
memcached高速缓存学习笔记001---memcached介绍和安装以及基本使用
查看>>
memcached高速缓存学习笔记003---利用JAVA程序操作memcached crud操作
查看>>
Memcached:Node.js 高性能缓存解决方案
查看>>
memcache、redis原理对比
查看>>
memset初始化高维数组为-1/0
查看>>
Metasploit CGI网关接口渗透测试实战
查看>>
Metasploit Web服务器渗透测试实战
查看>>
Moment.js常见用法总结
查看>>
MongoDB出现Error parsing command line: unrecognised option ‘--fork‘ 的解决方法
查看>>
mxGraph改变图形大小重置overlay位置
查看>>
MongoDB学习笔记(8)--索引及优化索引
查看>>
MQTT工作笔记0009---订阅主题和订阅确认
查看>>
ms sql server 2008 sp2更新异常
查看>>