#include #include //用于设置输出小数点后的位数

using namespace std;

int main() { int N; cin >> N;

int total = 0;
for (int i = 0; i < N; i++) {
    int price;
    cin >> price;
    total += price;
}

double finalPrice;
if (total > 100) {
    finalPrice = total * 0.9;
} else {
    finalPrice = total;
}

cout << fixed << setprecision(2) << finalPrice << endl;

return 0;

}

C++ 编程练习:商场折扣计算

原文地址: https://www.cveoy.top/t/topic/qjBi 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录