文章
34
粉丝
18
获赞
6
访问
14.4k
#include <iostream>
using namespace std;
double calculate_bonus(double profit) {
double bonus = 0;
if (profit <= 100000) {
bonus = profit * 0.1;
} else if (profit <= 200000) {
bonus = 100000 * 0.1 + (profit - 100000) * 0.075;
} else if (profit <= 400000) {
bonus = 100000 * 0.1 + 100000 * 0.075 + (profit - 200000) * 0.05;
} else if (profit <= 600000) {
bonus = 100000 * 0.1 + 100000 * 0.075 + 200000 * 0.05 + (profit - 400000) * 0.03;
} else if (profit <= 1000000) {
bonus = 100000 * 0.1 + 100000 * 0.075 + 200000 * 0.05 + 200000 * 0.03 + (profit - 600000) * 0.015;
} else {
bonus = 100000 * 0.1 + 100000 * 0.075 + 200000 * 0.05 + 200000 * 0.03 + 400000 * 0.015 + (profit - 1000000) * 0.01;
}
return bonus;
}
int main() {
double profit;
cin >> profit;
double bonus = calculate_bonus(profit);
cout<< bonus << endl;
...
登录后发布评论
暂无评论,来抢沙发