HDU 5630 Rikka with Chess
来源:互联网 发布:淘宝客在哪推广 编辑:程序博客网 时间:2024/05/17 06:45
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=5630
题意:一个n*m的黑白相间的棋盘,每次可以选择一个矩形把其中的所有格子反色,把所有格子变成一种颜色时的最少的操作次数
思路:可以说是最水的一次BC了,刚几分钟就几百A了,我却搞了十几分钟,刚开始想的是一块一块换,后来才想到是一行一行换,如4.4,先换2.4行,再换1.3列等。n或m是奇数换偶数行偶数列,偶数就无所谓了
AC代码:
#include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>#include <queue>#include <stack>#include <map>#include <cstring>#include <climits>#include <cmath>#include <cctype>const int inf = 0x7f7f7f7f;//2139062143typedef long long ll;using namespace std;int main(){ int t; scanf("%d",&t); while(t--) { int n,m; scanf("%d%d",&n,&m); printf("%d\n",n/2+m/2); } return 0;}
0 0
- HDU 5630 Rikka with Chess
- HDU 5630 Rikka with Chess
- HDU 5630 Rikka with Chess
- HDU 5630 Rikka with Chess
- HDU 5630 Rikka with Chess
- hdu 5630 Rikka with Chess
- HDU 5630:Rikka with Chess【规律】
- Hdu 5630 Rikka with Chess【水】
- HDU杭电5630 ( Rikka with Chess )
- HDU 5630 Rikka with Chess(翻棋子)
- HDU 5630 Rikka with Chess(构造)
- HDOJ 5630 Rikka with Chess
- HDOJ 5630-Rikka with Chess
- HDOJ 5630 Rikka with Chess
- hdoj 5630 Rikka with Chess
- hdoj 5630-Rikka with Chess
- hdu 5630 Rikka with Chess【思维+递推】
- HDOJ 5630Rikka with Chess(游戏)
- OpenJudge百炼习题解答(C++)--题4109:公共朋友-Common Friends
- hdu 3001 Travelling 状压dp
- JQuery学习—JQuery的Validform学习
- OpenGL ES 学习教程(十) Light casters 之 Spot Light (聚光灯)
- macbook pro安装linux系统
- HDU 5630 Rikka with Chess
- VS2015--win32工程配置的一些想法之warning LNK4042: 对象被多次指定;已忽略多余的指定
- 机器学习系列(3)_逻辑回归应用之Kaggle泰坦尼克之灾
- UVA 12658 模拟
- VS2010~VS2013中文注释带红色下划线的解决方法
- 在文章中使用amsmath宏包的原因
- 积跬步至千里系列之十--编译Android源码实践
- JSP-include指令
- java学习笔记-参数的调用