题目传送门

 /*
题意:一个n×m的矩形,相邻的颜色不同,黑或白。问最少的翻转次数,每次翻转可指定任意一个子矩形
思维题:最少要把偶数行和列翻转,也就是n/2+m/2次
*/
#include <cstdio>
using namespace std; int main(void) //Gym 100553A Alter Board
{
// freopen ("A.in", "r", stdin);
freopen ("alter.in", "r", stdin);
freopen ("alter.out", "w", stdout); int n, m;
while (scanf ("%d%d", &n, &m) == )
{
printf ("%d\n", n / + m / );
for (int i=; i<=n; i+=)
{
printf ("%d %d %d %d\n", i, , i, m);
}
for (int i=; i<=m; i+=)
{
printf ("%d %d %d %d\n", , i, n, i);
}
} return ;
}
05-11 09:37