Advertisement
Guest User

Untitled

a guest
Nov 30th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.50 KB | None | 0 0
  1. ucinanie([], POZOSTALA, POZOSTALA).
  2. ucinanie([G|O], RESZTA, WYNIK) :-
  3.     ucinanie(O, [G|RESZTA], WYNIK).
  4. ucinanie([G1, G2|O], PUSTA, WYNIK) :-
  5.     G is G1 + G2,
  6.     ucinanie([G|O], PUSTA, WYNIK).
  7. ucinanie(JEDYNKI, WYNKON) :-
  8.     ucinanie(JEDYNKI, [], WYNKON).
  9.  
  10. max_tablica_jedynek(0, []).
  11. max_tablica_jedynek(N, [1|NPOW]) :-
  12.     N > 0,
  13.     K is N - 1,
  14.     max_tablica_jedynek(K, NPOW).
  15.  
  16. kombinacja(N, WYNIK) :-
  17.     max_tablica_jedynek(N, JEDYNKI),
  18.     findall(Y, ucinanie(JEDYNKI, Y), WYNIK).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement