博客
关于我
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/

你可能感兴趣的文章
mysql replace用法
查看>>
Mysql Row_Format 参数讲解
查看>>
mysql select, from ,join ,on ,where groupby,having ,order by limit的执行顺序和书写顺序
查看>>
MySQL Server 5.5安装记录
查看>>
mysql server has gone away
查看>>
mysql slave 停了_slave 停止。求解决方法
查看>>
MySQL SQL 优化指南:主键、ORDER BY、GROUP BY 和 UPDATE 优化详解
查看>>
MYSQL sql语句针对数据记录时间范围查询的效率对比
查看>>
mysql sum 没返回,如果没有找到任何值,我如何在MySQL中获得SUM函数以返回'0'?
查看>>
mysql Timestamp时间隔了8小时
查看>>
Mysql tinyint(1)与tinyint(4)的区别
查看>>
mysql union orderby 无效
查看>>
mysql v$session_Oracle 进程查看v$session
查看>>
mysql where中如何判断不为空
查看>>
MySQL Workbench 使用手册:从入门到精通
查看>>
mysql workbench6.3.5_MySQL Workbench
查看>>
MySQL Workbench安装教程以及菜单汉化
查看>>
MySQL Xtrabackup 安装、备份、恢复
查看>>
mysql [Err] 1436 - Thread stack overrun: 129464 bytes used of a 286720 byte stack, and 160000 bytes
查看>>
MySQL _ MySQL常用操作
查看>>