题解 | #牛牛的快递#
牛牛的快递
https://www.nowcoder.com/practice/41b42e7b3c3547e3acf8e90c41d98270
#include <stdio.h> #include <math.h> int main() { float a; char b; int cost; while (scanf("%f %c", &a, &b) != EOF) { // 注意 while 处理多个 case // 64 位输出请用 printf("%lld") to if(a <= 1) cost = 20 + (b == 'y' ? 5 : 0); else cost = 20 + ceil(a - 1) + (b == 'y' ? 5 : 0); printf("%d\n", cost); } return 0; }