Shipping Charge
Python
Medium
2 views
Problem Description
Read weight w (kg) and distance d (km). Charge rules: if w100 add extra 100. Output final charge.
Input Format
One line: w d.
Output Format
One integer charge.
Official Solution
import sys
p=sys.stdin.read().strip().split()
if not p: sys.exit(0)
w=int(p[0]); d=int(p[1])
charge=50
if w>2:
charge+= (w-2)*20
if d>100:
charge+=100
sys.stdout.write(str(charge))
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!