Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Лекция №2 21-07-2024
- ##
- //Println(1+2, 3-4, 5*6, 7/8, 2**8);
- //Println(Cos(60/180*Pi), Sin(123), Logn(2,256));
- //var a: byte;
- //a := 250;
- //Print(a);
- //a := a + 10;
- //Print(a);
- Println(100/7, 100 div 7, 100 mod 7);
- Println(100/-7, 100 div -7, 100 mod -7);
- Println(-100/7, -100 div 7, -100 mod 7);
- Println(-100/-7, -100 div -7, -100 mod -7);
- ////////////////////////////////////////
- ## //просто функция
- function Fn1(a: integer): integer;
- begin
- if (a > 100) then Result := a - 100
- else Result := a * 10;
- end;
- Print(Fn1(550));
- ////////////////////////////////////////
- ## //фибоначчи
- [cache] // кэширование - это (определение)
- function Fibo(n: integer): Biginteger;
- begin
- if n <= 2 then Result := 1
- else Result := Fibo(n-1) + Fibo(n-2)
- end;
- for var i:=1 to 10000 do Fibo(i);
- Print(Fibo(10000))
- /////////////////////////////
- ## //№16 ЕГЭ
- function F(n: integer): BigInteger;
- begin
- if (n = 1) then Result :=1;
- if (n mod 2 = 0) then Result := n+F(n-1);
- if (n > 1) and (n mod 2 = 1) then Result := 2*F(n-2)
- end;
- Print(F(26))
- ///////////////////////////////////////////////
- ## //№23 ЕГЭ
- function F(a,b: integer): integer ;
- begin
- if (a > b) or (a = 12) then Result := 0
- else if a=b then Result := 1
- else Result := F(a+1,b)+F(a+2,b)+F(a*3,b)
- end;
- Print(F(2,9) * F(9,19))
Advertisement
Add Comment
Please, Sign In to add comment