1 条题解

  • 0
    @ 2025-12-16 21:06:53

    #include using namespace std;

    int main() { int M, K; while (cin >> M >> K) { int money = M; int days = 0; int spent = 0; // 记录总花费(用于判断赠送)

        while (money > 0) {
            money--;      // 花1元
            days++;
            spent++;
            if (spent % K == 0) {
                money++;  // 赠送1元
            }
        }
        cout << days << endl;
    }
    return 0;
    

    }

    • 1

    信息

    ID
    14521
    时间
    1000ms
    内存
    256MiB
    难度
    10
    标签
    递交数
    3
    已通过
    3
    上传者