From b73a399210acdbae06ca6e1d9947a6fed9c32f35 Mon Sep 17 00:00:00 2001 From: aguzik Date: Tue, 21 May 2024 09:17:59 +0200 Subject: [PATCH] matura 20.05 --- index.html | 11 +++++++++++ main.py | 15 +++++++++++++++ scirpt.js | 17 +++++++++++++++++ sufix.js | 12 ++++++++++++ 4 files changed, 55 insertions(+) create mode 100644 index.html create mode 100644 main.py create mode 100644 scirpt.js create mode 100644 sufix.js diff --git a/index.html b/index.html new file mode 100644 index 0000000..0b0a059 --- /dev/null +++ b/index.html @@ -0,0 +1,11 @@ + + + + + + Document + + + + + \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..0b8a956 --- /dev/null +++ b/main.py @@ -0,0 +1,15 @@ +def iloczyn(x: int ,y: int ) -> int: + if y == 1: + return x + else: + k = y // 2 + z = iloczyn(x,k) + if y % 2 == 0: + return z + z + else: + return x + z + z + +print(iloczyn(9,11)) +print(iloczyn(9,5)) +print(iloczyn(9,2)) +print(iloczyn(9,1)) \ No newline at end of file diff --git a/scirpt.js b/scirpt.js new file mode 100644 index 0000000..0c2535a --- /dev/null +++ b/scirpt.js @@ -0,0 +1,17 @@ +function iloczyn(x, y) { + if (y == 1) { + return x; + } else { + k = Math.floor(y / 2); + z = iloczyn(x, k); + if (y % 2 == 0) { + return z + z; + } else { + return x + z + z; + } + } +} + +console.log(iloczyn(9, 11)); +console.log(iloczyn(9, 5)); +console.log(iloczyn(9, 1)); diff --git a/sufix.js b/sufix.js new file mode 100644 index 0000000..9979353 --- /dev/null +++ b/sufix.js @@ -0,0 +1,12 @@ +function sufixy(slowo) { + dlugosc = slowo.length; + let wynik = Array(); + + for (let i = 0; i < dlugosc; i++) { + wynik.push(slowo); + slowo = slowo.slice(1); + } + return "Nieposortowane: " + wynik + ", Posortowane: " + wynik.sort(); +} + +console.log(sufixy("slowo"));