This repository has been archived on 2024-12-25. You can view files and clone it, but cannot push or open issues or pull requests.

162 lines
2.2 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var N,K,A,B,C,D,E,F,G,H,I,J,L,P,M,O,Q,Z:UINT64;
begin
repeat
WriteLn('ВВодим кол-во денег');
ReadLn(A);
WriteLn('Стоимость 1 упаковки');
ReadLn(B);
writeln('За какое кол-во упаковок можно получить дополнительную');
readln(D);
writeln('За какое кол-во упаковок идёт 2 акция');
readln(E);
N:=A div B;
writeln(N);
if (D<=N) then
begin
F:=N-D;
G:=G+1;
end;
if (D<=F) then
begin
F:=F-D;
G:=G+1;
end;
if (D<=F) then
begin
F:=F-D;
G:=G+1;
end;
if (D<=F) then
begin
F:=F-D;
G:=G+1;
end;
if (D<=F) then
begin
F:=F-D;
G:=G+1;
end;
if (D<=F) then
begin
F:=F-D;
G:=G+1;
end;
if (D<=F) then
begin
F:=F-D;
G:=G+1;
end;
if (D<=F) then
begin
F:=F-D;
G:=G+1;
end;
if (D<=F) then
begin
F:=F-D;
G:=G+1;
end;
if (D<=F) then
begin
F:=F-D;
G:=G+1;
end;
Z:=N+G;
if (E<=N) then
begin
H:=N-E;
I:=N*B;
I:=I+N;
J:=I div B;
end;
K:=J+H;
L:=A div 2;
P:=L div B;
if (D<=P) then
begin
M:=P-D;
O:=O+1;
end;
if (E<=P) then
begin
H:=P-E;
I:=N*B;
I:=I+P;
J:=I div B;
end;
if (E<=P) then
begin
H:=P-E;
I:=N*B;
I:=I+P;
J:=I div B;
end;
if (E<=P) then
begin
H:=P-E;
I:=N*B;
I:=I+P;
J:=I div B;
end;
if (E<=P) then
begin
H:=P-E;
I:=N*B;
I:=I+P;
J:=I div B;
end;
if (E<=P) then
begin
H:=P-E;
I:=N*B;
I:=I+P;
J:=I div B;
end;
if (E<=P) then
begin
H:=P-E;
I:=N*B;
I:=I+P;
J:=I div B;
end;
if (E<=P) then
begin
H:=P-E;
I:=N*B;
I:=I+P;
J:=I div B;
end;
if (E<=P) then
begin
H:=P-E;
I:=N*B;
I:=I+P;
J:=I div B;
end;
Q:=J+H;
if (Z<=K) then
begin
C:=K;
end;
if (K<=Z) then
begin
C:=Z;
end;
Writeln('Без акций можно купить: ',N,' упаковок');
WriteLn('По первой акции можно купить ',Z,' упаковок');
writeln('По второй акции можно купить: ',K,' упаковок');
writeln('Испльзуя обе акции пополам можно купить: ',Q,' упаковок');
if (Z<=K) then
begin
writeln('Выгодно по 2 акции');
end;
if (K<=Z) then
begin
writeln('Выгодно по 1 акции');
end;
writeln('Самое выгодное число: ',C,' упаковок');
writeln('-----------------------------------------------------------------------');
sleep(10000);
until C=224;
End.