1 条题解

  • 0
    @ 2025-11-30 16:26:52

    C++ :

    #include <iostream>
    using namespace std;
    int main() {
        int books, cost = 0;
        cin >> books;
        for (int i = 1; i <= books; i++) {
            if (i > 3) {
                cost += 5 * 0.8; // 8折
            } else {
                cost += 5;
            }
        }
        cout << cost;
        return 0;
    }
    
    • 1

    T1-7-E6 租书折扣计算(循环结构 - for)

    信息

    ID
    1372
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者