Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- czy_spojny(H):- not nalezy(0,H), wierzcholki(H).
- wierzcholki(H):-
- dlugosc(H,Liczba),
- suma(H,Sum),
- X is Sum/2,
- Y is Liczba - 1,
- X >= Y.
- dlugosc( [],0 ).
- dlugosc( [_|T],L ) :- dlugosc( T,P ), L is P + 1.
- suma( [],0 ).
- suma( [H|T],X ) :- suma( T,P ), X is P + H.
- nalezy( X,[X|_] ).
- nalezy( X,[_|T] ) :- nalezy( X,T ).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement