题解 | #牛牛的快递#
牛牛的快递
https://www.nowcoder.com/practice/41b42e7b3c3547e3acf8e90c41d98270
#include <stdio.h> int main() { float a = 0.0f; char b = 0; int cost = 20; scanf("%f %c", &a, &b); //输入格式两者间要有空格,不然空格会被字符变量吸收导致无法接受'n'或'y' if (a > 1) { if (a == (int)a) cost += a - 1; else cost += a; } if (b == 'y') cost += 5; printf("%d", cost); return 0; }