Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. czy_spojny(H):- not nalezy(0,H), wierzcholki(H).
  2.  
  3. wierzcholki(H):-
  4. dlugosc(H,Liczba),
  5. suma(H,Sum),
  6. X is Sum/2,
  7. Y is Liczba - 1,
  8. X >= Y.
  9.  
  10. dlugosc( [],0 ).
  11. dlugosc( [_|T],L ) :- dlugosc( T,P ), L is P + 1.
  12.  
  13. suma( [],0 ).
  14. suma( [H|T],X ) :- suma( T,P ), X is P + H.
  15.  
  16.  
  17.  
  18. nalezy( X,[X|_] ).
  19. nalezy( X,[_|T] ) :- nalezy( X,T ).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement