Describe
The postage is calculated based on the weight of the message and whether the user chooses expedited. Calculation rule: Weight within 1000 grams (including 1000 grams), the basic fee of 8 yuan. More than 1000 grams of the portion, each 500 grams of extra charge of 4 yuan, less than 500 grams of the portion of 500 grams calculation; If the user chooses expedited, more than 5 yuan.
Enter an input line that contains an integer and a character separated by a space, indicating the weight (in grams) and whether it is expedited. If the character is Y, the description selects expedited, and if the character is n, the description is not expedited. An output line that contains an integer representing the postage. Sample input
X y
Sample output
17
1#include <stdio.h>2 intMain ()3 {4 inth,f=0;5 CharZ;6scanf"%d%c",&h,&z);7h=h- +; f=8;8 while(h>0)9 {Tenh-= -; f+=4; One } A if(z=='y') f+=5; -printf"%d\n", f); - return 0; the}
1-4-14: Calculate postage