|
|||
begin. for vari:=1 ton do. for varj:=1 ton do. if(A[i,j]=1) then. if(A[i,j]=0) then. fori:=1 ton do. fori:=1 to20 do ⇐ ПредыдущаяСтр 10 из 10 begin Init; Print(A); for vart: =1 to100 do begin for vari: =1 ton do for varj: =1 ton do begin vars: =sosedi(i, j); if(A[i, j]=1) then if( (s< 2) or(s> 3) ) thenB[i, j]: =0 else if((s=2) or(s=3)) thenB[i, j]: =1; if(A[i, j]=0) then if(s=3) thenB[i, j]: =1; end; A: =B; Print(A); Sleep(100); Clrscr; end; end.
12) монте-карло programmonte_karlo; consta=0; b=1; n=100000000; varx, s: real; i: integer;
functiony(x: real): real;
begin y: =x; end;
begin s: =0; fori: =1 ton do begin x: =a+(b-a)*random(); s: =s+y(x)/n; end; writeln('значение интеграла монте-карло ', s*(b-a): 2: 5); end.
12)генератор programgenerator; usescrt; varx, m, a, x1, c, i, n: integer;
procedureinit; begin a: =1; x: =5; c: =1; m: =225; end; functionale: integer; begin x: =(a*x+c)modm; ale: =x; end;
begin clrscr; init; x1: =x; repeat; n: =n+1; write(ale: 8); until x=x1; writeln; write('период=', n); readln; fori: =1 to20 do write(ale: 8); readln; end.
|
|||
|