提交时间:2024-02-16 00:11:28

运行 ID: 40689

#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; }