PTA——四舍五入

PTA

7-18 出租车计价 (15 分)

#include<stdio.h>
int main() {
    double s,w;
    int t;
    scanf("%lf %d",&s,&t);
    if(s <= 3)
        w = 10;
    else if(s > 3 && s <= 10)
        w = 10 + (s-3) * 2;
    else
        w = 10 + 14 + (s-10) * 3;
    printf("%d",(int)(w + t / 5 * 2 + 0.5));
}

猜你喜欢

转载自www.cnblogs.com/cxc1357/p/10644684.html