题解 | #牛牛的快递#
牛牛的快递
http://www.nowcoder.com/practice/41b42e7b3c3547e3acf8e90c41d98270
#include <stdio.h> #include <math.h>
int main() { float a = 0; char b = 0; float sum = 0; float c = 0; float d = 0; scanf("%f %c", &a, &b);
if (a <= 1)
{
sum = 20;
if (b == 121)
{
sum += 5;
}
}
else if (a > 1)
{
c = ceil(a);
sum = 20 + c - 1.0;
if (b == 121)
{
sum += 5;
}
}
printf("%.0f\n", sum);
return 0;
}