C3EQUALZ

Теория игр 2 кучи, 19,20,21 задания ЕГЭ

Jan 7th, 2022 (edited)
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.44 KB | None | 0 0
  1. Решение 19 задания
  2. function f(n,s, turn: integer): boolean;
  3. begin
  4.  if (n+s>=77) and (turn=2) then result:=True else
  5.    if (n+s<77) and (turn=2) then result:=False else
  6.      if (n+s>=77) and (turn<>2) then result:=False else
  7.          result:=f(n,S*2,turn+1) or f(n,S+1,turn+1) or f(n*2,S,turn+1) or f(n+1,S,turn+1);
  8. end;
  9. begin
  10.   for var i:=1 to 69 do
  11.     if f(7,i,0) then begin print('19:',i);
  12.       break;
  13.       end;
  14. end.
Add Comment
Please, Sign In to add comment