114514

nztao  •  11个月前


#include <iostream>
#include <iomanip>
#include <cmath>

int main() {
    float weight;
    std::cin >> weight;  // 读取行李的重量

    float fee;
    if (weight <= 20) {
        fee = std::ceil(weight) * 1.68;
    }
    else {
        fee = 20 * 1.68 + std::ceil(weight - 20) * 1.98;
    }

    std::cout << std::fixed << std::setprecision(2) << fee << std::endl;  // 输出行李的收费,保留两位有效小数

    return 0;

评论:

请先登录,才能进行评论