#t233. 计算邮资
计算邮资
Postage Calculation
Problem Description
Compute the postage based on the weight of the mail and whether the user chooses express delivery. The rules are:
- For a weight of grams or less (including grams), the base fee is yuan.
- For the part exceeding grams, an overweight fee of yuan is charged per grams; any part less than grams is counted as a full grams.
- If the user chooses express delivery, an extra yuan is charged.
Input Format
The input gives one line containing a positive integer and one character, separated by a space, representing the weight (in grams) and whether express delivery is chosen. If the character is y, express delivery is chosen; if it is n, it is not.
Output Format
Output one line containing a single integer: the postage.
Sample Input
1200 y
Sample Output
17
Hint
- The overweight part "any fraction under grams counts as grams" — that is rounding up. Think about how integer division expresses it (the same trick as the apple-worm problem).
- The input is "integer, space, character", and the express flag is the character
y. - Check against the sample:
1200 y→17.