Application of variational principle in problems of a binary alloy and Ising systemстатья