matura 20.05
This commit is contained in:
commit
b73a399210
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<script src="scirpt.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -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))
|
|
@ -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));
|
|
@ -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"));
|
Loading…
Reference in New Issue