No. 1385

挤牛奶问题

Tips: 查找之前对数据进行一下排列会比较好; 两个“最长”放在一趟遍历里查找。

 

 

class LT
{
public:
    int bt;
    int ct;
    int duration;

    LT(): bt(0), ct(0), duration(0) {}

    LT& operator=(LT one)
    {
        bt=one.bt;
        ct=one.ct;
        duration=one.duration;
        return *this;
    }
};

赋值操作符重载时,必须返回对 *this 的引用

 

相关文章:

  • 2022-03-15
  • 2021-08-12
  • 2021-09-30
  • 2021-06-23
  • 2021-11-18
  • 2021-06-08
  • 2021-06-26
  • 2022-01-10
猜你喜欢
  • 2021-07-16
  • 2021-12-30
  • 2021-06-21
  • 2021-10-31
  • 2021-12-02
  • 2021-08-07
相关资源
相似解决方案