Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- piatki(X1,X2,Y2,Y3):-
- L=[1,2,3,4,5,6,7,8,9],
- select(X1,L,_),
- select(X2,L,_),
- select(Y2,L,_),
- select(Y3,L,_),
- P11 is (1*X1)//10,
- P12 is ((1*X2)+P11) // 10,
- S12 is ((1*X2)+P11) mod 10,
- S13 is ((1*5)+P12),
- P21 is (Y2*X1)//10,
- P22 is ((Y2*X2)+P21)//10,
- P23 is ((Y2*5)+P22)//10,
- S21 is (Y2*X1) mod 10,
- S22 is ((Y2*X2)+P21) mod 10,
- S23 is ((Y2*5)+P22) mod 10,
- S24 is P23,
- S24 \= 0,
- P31 is (Y3*X1)//10,
- P32 is ((Y3*X2)+P31)//10,
- P33 is ((Y3*5)+P32)//10,
- 5 =:= (Y3*X1) mod 10,
- S32 is ((Y3*X2)+P31) mod 10,
- 5 =:= ((Y3*5)+P32) mod 10,
- S34 is P33,
- S34 \= 0,
- 4 =:= (S21 + S12) mod 10,
- PW2 is (S21+S12)//10,
- PW3 is ((S13 + S22 + 5) + PW2)//10,
- 5 =:= (S23 + S32 + PW3) mod 10.
- pingpong(P,K,B,E):-
- L=[1,2,3,4,5],
- select(P,L,L1),
- select(K,L1,L2),
- select(B,L2,L3),
- select(E,L3,_),
- E > K,
- K > B,
- P > K,
- P > B,
- B + E > P + K.
- wynik2(A1,A0,B2,B1,B0):-
- N = [1,2,3,4,5,6,7,8,9],
- L = [1,2,3,4,5,6,7,8,9,0],
- select(A1, L,_),
- select(A0, L,_),
- select(B2, L,_),
- select(B1, L,_),
- select(B0, L,_),
- X0 is A0*B0,
- X1 is A0*B1 + X0 // 10,
- X2 is A0*B2 + X1 // 10,
- X3 is X2 // 10,
- select(X3, N,_),
- Y0 is A1*B0,
- Y1 is A1*B1 + X0 // 10,
- Y2 is A1*B2 + X1 // 10,
- Y3 is X2 // 10,
- select(Y3, N,_),
- Z0 is 6*B0,
- Z1 is 6*B1 + Z0 // 10,
- Z2 is 6*B2 + Z1 // 10,
- Z3 is Z2 // 10,
- select(Z3, N,_),
- W0 is X0 mod 10,
- W1 is (X1 mod 10) +(Y0 mod 10) + W0 // 10,
- W2 is (X2 mod 10) +(Y1 mod 10) + (Z0 mod 10) + W1 // 10,
- W3 is (X3 mod 10) +(Y2 mod 10) + (Z1 mod 10) + W2 // 10,
- W4 is Z2 + W3//10,
- W5 is Z3 + W4//10,
- select(W5, N,_),
- 4 =:= W1 mod 10,
- 5 =:= W3 mod 10,
- 5 =:= W4 mod 10,
- true.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement