文章

28

粉丝

82

获赞

79

访问

47.8k

头像

促销计算 题解:

P1091 兰州大学机试题
发布于 2024年3月
阅读数 1.4k

#include<stdio.h>
int main()
{
    double count;
    scanf("%lf",&count);
    if(0<count&&count<=1000)
    {
        printf("discount=1,pay=%g\n",count);
    }
    if(1000<=count&&count<2000)
    {
        printf("discount=0.95,pay=%g\n",count*0.95);
    }
    if(2000<=count&&count<3000)
    {
        printf("discount=0.9,pay=%g\n",count*0.9);
    }
    if(3000<=count&&count<5000)
    {
        printf("discount=0.85,pay=%g\n",count*0.85);
    }
    if(count>=5000)
    {
        printf("discount=0.8,pay=%g\n",count*0.8);
    }
    return 0;
}



登录后发布评论

暂无评论,来抢沙发