题解 | #牛牛的快递#
牛牛的快递
https://www.nowcoder.com/practice/41b42e7b3c3547e3acf8e90c41d98270
#include <stdio.h>
int main() {
float weight=0;
char chooce=0;
int price=0;
while (scanf("%f %c\n", &weight, &chooce) != EOF) { // 注意 while 处理多个 case
// 64 位输出请用 printf("%lld") to
int m=weight/1;
m=weight/1==m?m:m+1;
if(chooce=='y')//加急,price加5元
{
price=20+5+m-1;
}
else if(chooce=='n')
{
price=20+m-1;
}
printf("%d\n", price);
}
return 0;
}
查看24道真题和解析