美文网首页编程练习
codeforces 50A (greedy, math)

codeforces 50A (greedy, math)

作者: codinRay | 来源:发表于2017-03-31 08:25 被阅读0次

http://codeforces.com/problemset/problem/50/A

生词:
overlap v.重叠

题面:

给你一个M × N的矩形和一些2 × 1的多米诺骨牌,可以旋转这些牌。

求在这个矩形里可以放下骨牌的最大数量。

分析:

给了一个greedy的标签,所以直接思考局部最优达成整体最优。

直接输出 m*n/2 即可。

// codeforces
// 50A
// greedy, math
#include <iostream>
using namespace std;
int main() {
    int m, n;
    while (cin >> m >> n) {
        cout << (m*n / 2) << endl;
    }
    return 0;
}

相关文章

网友评论

    本文标题:codeforces 50A (greedy, math)

    本文链接:https://www.haomeiwen.com/subject/yhumottx.html