题解 | 网购

网购

https://www.nowcoder.com/practice/5d7dfd405e5f4e4fbfdff6862c46b751

#include <stdio.h>

int main() {
    int b,c,d;
    double a,toll;
    scanf("%lf ",&a);
    scanf("%d %d %d", &b,&c,&d);
    if(b==12&&c==12) { 
        if(d==1)
        toll=(a*0.8-50.00);
        if(d==0)
        toll=(a*0.8);
    }
    if(b==11&&b==11){
        if(d==1)
        toll=(a*0.7-50.00);
        if(d==0)
        toll=(a*0.7);
    }
    if(toll<=0)
    printf("0.00");
    else
    printf("%.2lf\n", toll);
    return 0;
}

我写的较为复杂,用了多个条件语句

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务