Guest User

03. Combinations

a guest
Dec 8th, 2019
105
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. n = int(input())
  2. count_combinations = 0
  3. for x1 in range(0, n + 1):
  4.     for x2 in range(0, n + 1):
  5.         for x3 in range(0, n + 1):
  6.             #валидна: x1 + x2 + x3 = n
  7.             if x1 + x2 + x3 == n:
  8.                 count_combinations += 1
  9. print(count_combinations)
RAW Paste Data