Expression Value B
Python
Medium
2 views
Problem Description
Read three integers a b c. Compute a + b*c and a*b + c. Output both in one line.
Input Format
One line: a b c.
Output Format
One line: x y.
Constraints
Values fit in 64-bit.
Official Solution
import sys
p=sys.stdin.read().strip().split()
if len(p)<3: sys.exit(0)
a=int(p[0]); b=int(p[1]); c=int(p[2])
x=a+b*c
y=a*b+c
sys.stdout.write(f'{x} {y}')
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!