A题讨论最下面的颜色和最上面的颜色,然后去重即可。

具体实现只要一句话就行了。(见代码)

class TheBrickTowerEasyDivOne
{
    public:
        int find(int rc, int rh, int bc, int bh)
        {
            return (2 + (rh != bh)) * min(rc, bc) + (rc != bc);
        }
};

Comments

comments powered by Disqus