You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
222B

  1. import sys
  2. ans1 = 0
  3. ans2 = 0
  4. for line in sys.stdin.readlines():
  5. a, b, c = sorted(map(int, line.split('x')))
  6. ans1 += 2 * (a * b + b * c + a * c) + a * b
  7. ans2 += a * b * c + 2 * (a + b)
  8. print(ans1)
  9. print(ans2)