1 条题解

  • 0
    @ 2026-5-3 21:15:33

    最优策略是每一步都尽可能走最大的步长。因此,大象应该先走若干次距离为 5 5 的步,最后可能再走一次更小的步(或者不走)。答案等于: ⌊(x+4)/5⌋

    #include <iostream>
     
    using namespace std;
     
    int main() {
        int x;
        cin >> x;
        cout << (x + 4) / 5 << '\n';
    }
    
    • 1

    信息

    ID
    6769
    时间
    1000ms
    内存
    256MiB
    难度
    5
    标签
    递交数
    1
    已通过
    1
    上传者