Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
40689 | yejiaxiangBMT | 计算邮资 | C++ | 通过 | 0 MS | 236 KB | 539 | 2024-02-16 00:11:28 |
#include <iostream> using namespace std; int main() { int weight; char u; cin >> weight >> u; int price; if (u == 'y') {if (weight > 1000) {if (weight % 500 != 0) {price = ((weight - 1000) / 500 + 1) * 4 + 8+5;} else {price = ((weight - 1000) / 500 ) * 4 + 8+5;}} else {price = 8+5;}} if (u == 'n') {if (weight > 1000) {if (weight % 500 != 0) {price = ((weight - 1000) / 500 + 1) * 4 + 8;} else {price = ((weight - 1000) / 500 ) * 4 + 8;}} else {price = 8;}} cout << price; return 0; }