Advertisement
Guest User

03. Combinations

a guest
Dec 8th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement