题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=5630
题意:一个n*m的黑白相间的棋盘,每次可以选择一个矩形把其中的所有格子反色,把所有格子变成一种颜色时的最少的操作次数
思路:可以说是最水的一次BC了,刚几分钟就几百A了,我却搞了十几分钟,刚开始想的是一块一块换,后来才想到是一行一行换,如4.4,先换2.4行,再换1.3列等。n或m是奇数换偶数行偶数列,偶数就无所谓了
AC代码:
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=5630
题意:一个n*m的黑白相间的棋盘,每次可以选择一个矩形把其中的所有格子反色,把所有格子变成一种颜色时的最少的操作次数
思路:可以说是最水的一次BC了,刚几分钟就几百A了,我却搞了十几分钟,刚开始想的是一块一块换,后来才想到是一行一行换,如4.4,先换2.4行,再换1.3列等。n或m是奇数换偶数行偶数列,偶数就无所谓了
AC代码:
Problem Description there are no other c
Problem Description
Problem Descs m querie
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M