文章

11

粉丝

0

获赞

35

访问

2.7k

头像
利润提成 题解:c++
P1040 北京大学机试题
发布于2026年2月28日 12:43
阅读数 145

#include<iostream>

using namespace std;

int main(){
    long long profit; // 使用 long long 防止溢出
    double bonus = 0; // 使用 double 保留小数
    cin >> profit;

    if(profit > 1000000){
        bonus = (profit - 1000000) * 0.01 + 
                400000 * 0.015 + 
                200000 * 0.03 + 
                200000 * 0.05 + 
                100000 * 0.075 + 
                100000 * 0.1;
    } else if(profit > 600000){ // 注意:这里不需要写 &&,因为上面已经过滤了
        bonus = (profit - 600000) * 0.015 + 
                200000 * 0.03 + 
                200...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发