zoukankan      html  css  js  c++  java
  • hdu5630 BestCoder Round #73 (div.2)

    Rikka with Chess

     
     Accepts: 393
     
     Submissions: 548
     Time Limit: 2000/1000 MS (Java/Others)
     
     Memory Limit: 65536/65536 K (Java/Others)
    问题描述
    一个n 	imes mn×m的黑白相间的棋盘,每次可以选择一个矩形把其中的所有格子反色。问把所有格子变成一种颜色时的最少操作次数。
    
    输入描述
    第一行一个整数 T(T leq 10)T(T10) 表示数据组数。
    
    每组数据有一行, 两个正整数 n,m(n leq 10^9, m leq 10^9)n,m(n109,m109)
    输出描述
    对于每组数据输出一行一个整数,代表最少需要的操作次数。
    输入样例
    3
    1 2
    2 2
    3 3
    输出样例
    1
    2
    2
    /*
    BestCoder Round #73 (div.2)
    hdu5630 Rikka with Chess
    思路:
    先对行进行翻转,然后对列进行翻转
    hhh-2016-02-25 11:27:16
    */
    #include <functional>
    #include <iostream>
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <algorithm>
    #include <map>
    #include <cmath>
    using namespace std;
    typedef long long ll;
    typedef long  double ld;
    const int maxn = 65;
    
    int main()
    {
        int T;
        scanf("%d",&T);
        while(T--)
        {
            int n,m;
            scanf("%d%d",&n,&m);
            printf("%d
    ",n/2 + m/2);
        }
        return 0;
    }
    

      

  • 相关阅读:
    oracle 锁查询
    ORACLE 本session产生的redo
    UML
    面向对象
    设计思维
    程序员习惯
    程序员修炼之道
    架构指南
    微服务架构
    测试用例
  • 原文地址:https://www.cnblogs.com/Przz/p/5409619.html
Copyright © 2011-2022 走看看