diff options
feat!: Update dunbar and update tables syntax
1 files changed, 143 insertions, 49 deletions
| -rw-r--r-- | src/teaching/upp-2023/additional1/index.du | 192 |
diff --git a/src/teaching/upp-2023/additional1/index.du b/src/teaching/upp-2023/additional1/index.du index 3cb8140..70cc715 100644 --- a/src/teaching/upp-2023/additional1/index.du +++ b/src/teaching/upp-2023/additional1/index.du @@ -59,11 +59,19 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. \n =[Примери:]= -.table -|=Извикване=||=Резултат=| -|:getRow(1234567, &row, &type, &value):||:row = 0, type = 0, value = 1234567:| -|:getRow(12345678, &row, &type, &value):||:row = 0, type = 1, value = 2345678:| -|:getRow(123456789, &row, &type, &value):||:row = 1, type = 2, value = 3456789:| +:table_2 +|= Извикване +|= Резултат + +|: getRow(1234567, &row, &type, &value) +|: row = 0, type = 0, value = 1234567 + +|: getRow(12345678, &row, &type, &value) +|: row = 0, type = 1, value = 2345678 + +|: getRow(123456789, &row, &type, &value) +|: row = 1, type = 2, value = 3456789 + ### б) обикновенно число @@ -80,31 +88,77 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. =[Примери:]= *[Възможно е отклонението на последния пример да бъде повече от 2 единици]* -.table -|=Извикване=||=Резултат=| -|:a = parseNumber(1, 5):||:a = 1.5:| -|:a = parseNumber(0, 37):||:a = 0.37:| -|:a = parseNumber(913, 0):||:a = 913.0:| -|:a = parseNumber(8388607, 18446744073709551615):||:a = 8388607.18446744073709551615:| +:table_2 +|= Извикване +|= Резултат + +|: a = parseNumber(1, 5) +|: a = 1.5 + +|: a = parseNumber(0, 37) +|: a = 0.37 + +|: a = parseNumber(913, 0) +|: a = 913.0 + +|: a = parseNumber(8388607, 18446744073709551615) +|: a = 8388607.18446744073709551615 + ### в) числов текст (част едно) Ако типа е "1", тогава стойността в базата данни е някакъв низ (последователност от букви), която е кодирана в числата. Всеки 5 бита в реда (от дясно на ляво) от таблица Б определя буква, като: -.table -|:Битове:||:Десетично число:||:Буква:| -|:00000 :||:0 :||:A :| -|:00001 :||:1 :||:B :| -|:00010 :||:2 :||:C :| -|:... :||: :||: :| -|:11001 :||:25 :||:Z :| -|:11010 :||:26 :||:*[шпация]*:| -|:11011 :||:27 :||:. :| -|:11100 :||:28 :||:, :| -|:11101 :||:29 :||:: :| -|:11110 :||:30 :||:? :| -|:11111 :||:31 :||:! :| +:table_3 +|: Битове +|: Десетично число +|: Буква + +|: 00000 +|: 0 +|: A + +|: 00001 +|: 1 +|: B + +|: 00010 +|: 2 +|: C + +|: ... +|: +|: + +|: 11001 +|: 25 +|: Z + +|: 11010 +|: 26 +|: *[шпация]* + +|: 11011 +|: 27 +|: . + +|: 11100 +|: 28 +|: , + +|: 11101 +|: 29 +|: : + +|: 11110 +|: 30 +|: ? + +|: 11111 +|: 31 +|: ! + Тоест ако в нашия тип данни запазваме само 10 бита, тогава числото "2" ще бъде `[0000000010]` и имаме низа "AC". Игнорирайте старшите битове, които остават като "остатък" (по-малко от 5 бита ширина). @@ -121,11 +175,19 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. \n =[Примери:]= -.table -|=Извикване=||=Резултат=| -|:decodeNumberText(2, decodedText):||:decodedText = "AAAAAAAAAAAC":| -|:decodeNumberText(257104811188071551, decodedText):||:decodedText = "HELLO WORLD!":| -|:decodeNumberText(1148238614786569150, decodedText):||:decodedText = "!. ,:?!. ,:?":| +:table_2 +|= Извикване +|= Резултат + +|: decodeNumberText(2, decodedText) +|: decodedText = "AAAAAAAAAAAC" + +|: decodeNumberText(257104811188071551, decodedText) +|: decodedText = "HELLO WORLD!" + +|: decodeNumberText(1148238614786569150, decodedText) +|: decodedText = "!. ,:?!. ,:?" + ### г) числов текст (част две) @@ -149,15 +211,31 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. \n =[Примери:]= -.table -|=Извикване=||=Резултат=| -|:decodeNumberText(0, 2, decodedText):||:decodedText = "AAAAAAAAAAAC":| -|:decodeNumberText(0, 257104811188071551, decodedText):||:decodedText = "HELLO WORLD!":| -|:decodeNumberText(0, 1148238614786569150, decodedText):||:decodedText = "!. ,:?!., :?":| -|:decodeNumberText(17, 632247276719883827, decodedText):||:decodedText = "AAAAAAAAAAAC":| -|:decodeNumberText(3, 368677860020992194, decodedText):||:decodedText = "HELLO WORLD!":| -|:decodeNumberText(30, 1073856582231288700, decodedText):||:decodedText = "!. ,:?!., :?":| -|:decodeNumberText(32, 1148238614786569150, decodedText):||:decodedText = "!. ,:?!., :?":| +:table_2 +|= Извикване +|= Резултат + +|: decodeNumberText(0, 2, decodedText) +|: decodedText = "AAAAAAAAAAAC" + +|: decodeNumberText(0, 257104811188071551, decodedText) +|: decodedText = "HELLO WORLD!" + +|: decodeNumberText(0, 1148238614786569150, decodedText) +|: decodedText = "!. ,:?!., :?" + +|: decodeNumberText(17, 632247276719883827, decodedText) +|: decodedText = "AAAAAAAAAAAC" + +|: decodeNumberText(3, 368677860020992194, decodedText) +|: decodedText = "HELLO WORLD!" + +|: decodeNumberText(30, 1073856582231288700, decodedText) +|: decodedText = "!. ,:?!., :?" + +|: decodeNumberText(32, 1148238614786569150, decodedText) +|: decodedText = "!. ,:?!., :?" + ### д) масив (част едно) @@ -174,9 +252,13 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. \n =[Пример:]= -.table -|=Извикване=||=Резултат=| -|:decodeArray(846406911526255600, arr):||:arr = { 0, 11, 11, 15, 0, 10, 9, 10, 0, 0, 15, 5, 3, 11, 15, 0 }:| +:table_2 +|= Извикване +|= Резултат + +|: decodeArray(846406911526255600, arr) +|: arr = { 0, 11, 11, 15, 0, 10, 9, 10, 0, 0, 15, 5, 3, 11, 15, 0 } + ### е) масив (част две) @@ -199,10 +281,16 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. \n =[Примери:]= -.table -|=Извикване=||=Резултат=| -|:decodeArray(360537, 846406911526255600, arr):||:arr = { 0, 11, 11, 11, 0, 11, 11, 11, 0, 0, 11, 11, 11, 11, 11, 0 }:| -|:decodeArray(3119812, 846406911526255600, arr):||:arr = { 8, 8, 8, 15, 8, 8, 8, 8, 8, 8, 15, 5, 3, 8, 15, 8 }:| +:table_2 +|= Извикване +|= Резултат + +|: decodeArray(360537, 846406911526255600, arr) +|: arr = { 0, 11, 11, 11, 0, 11, 11, 11, 0, 0, 11, 11, 11, 11, 11, 0 } + +|: decodeArray(3119812, 846406911526255600, arr) +|: arr = { 8, 8, 8, 15, 8, 8, 8, 8, 8, 8, 15, 5, 3, 8, 15, 8 } + ### ж) компресирани стойности @@ -243,10 +331,16 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. \n =[Примери:]= -.table -|=Извикване=||=Резултат=| -|:crypt = { 0, 2, 5 }\ndecompress(32770, crypt, &decompA, &decompB):||:decompA = 1, decompB = 5:| -|:crypt = { 2097151 }\ndecompress(7340032, crypt, &decompA, &decompB):||:decompA = 8388607, decompB = 18446744073709551615:| +:table_2 +|= Извикване +|= Резултат + +|: crypt = { 0, 2, 5 }\ndecompress(32770, crypt, &decompA, &decompB) +|: decompA = 1, decompB = 5 + +|: crypt = { 2097151 }\ndecompress(7340032, crypt, &decompA, &decompB) +|: decompA = 8388607, decompB = 18446744073709551615 + ### з) входни данни |