diff options
Diffstat (limited to '')
-rw-r--r-- | cv/cv.md | 32 | ||||
-rwxr-xr-x | skripti/fienta_availability.sh | 44 | ||||
-rwxr-xr-x | skripti/spotify_publish_saved.py | 43 | ||||
-rw-r--r-- | šola/ana1/kolokvij2.lyx | 121 | ||||
-rw-r--r-- | šola/ana1/teor3.lyx | 1086 | ||||
-rw-r--r-- | šola/aps1/dn/osvetlitev/Makefile | 4 | ||||
-rw-r--r-- | šola/aps1/dn/osvetlitev/in.txt | 9 | ||||
-rw-r--r-- | šola/aps1/dn/osvetlitev/resitev.cpp | 46 | ||||
-rw-r--r-- | šola/aps1/dn/zlivanje/in.txt | 26 | ||||
-rw-r--r-- | šola/aps1/dn/zlivanje/out.txt | 1 | ||||
-rw-r--r-- | šola/aps1/dn/zlivanje/resitev.cpp | 39 |
11 files changed, 1364 insertions, 87 deletions
@@ -22,8 +22,9 @@ Delovne izkušnje ================ * Študentsko delo: + - 2024-09: Pomoč pri administraciji strežnikov FMF - Pri SAZU popravil odjemni del sistema za zaznavanje napak na DAT kasetah -* Tehnik za osvetlitev odra v Klubu Gromka: 2022 - 2023 +* Tehnik za osvetlitev odra v Klubu Gromka: 2022 - 2024 Jezikovno znanje ================ @@ -32,6 +33,18 @@ Jezikovno znanje * **angleščina**: prvi tuji jezik - potrdilo o znanju na višjem nivoju slovenske mature * nemščina: drugi tuji jezik - potrdilo o znanju na nivoju C1 +Raziskovalno delo +================= + +* [Pridobivanje podatkov iz omrežja DHT, 2023](https://plus.cobiss.net/cobiss/si/sl/bib/163807491) -- COBISS.SI ID 163807491 pdf: <http://splet.sijanec.eu./dir/kon%C4%8Dna.pdf> +* [Kaj prenašamo s protokolom BitTorrent?, 2024](https://plus.cobiss.net/cobiss/si/sl/bib/209546499) -- COBISS.SI ID 209546499 pdf: <http://glasilo-fri.si./wp-content/uploads/2024/09/revija24.pdf#page=19> + +Tekmovanja +========== + +* 2023-10: Udeležil sem se tekmovanja v informacijski varnosti [ECSC](http://ecsc.no) na Norveškem v slovenski reprezentanci. +* Enkrat prvo in enkrat drugo mesto na [računalniškem tekmovanju ACM](http://rtk.ijs.si) ter srebrno priznanje na računalniškem tekmovanju ZOTKS + Področja znanja =============== @@ -59,23 +72,12 @@ Formalne izobrazbe na naštetih področjih nimam. + **Pretakanje zvoka** (icecast2) + **ArtNet**, **OSC** (uporabil za izdelavo DMX512 vmesnika za upravljanje luči) + **OBS**+**RTSP** na nginx - + Osnovno poznavanje delovanja delovanja IEEE 802.11 protokolov (Wi-Fi) + + Osnovno poznavanje delovanja IEEE 802.11 protokolov (Wi-Fi) * Umetniška tehnika - **Odrska osvetlitev** s protokolom DMX512 in programom QLC+ - Osnovne **izkušnje obdelave zvoka v živo** na mešalkah Behringer X32 in PreSonus StudioLive 32SX - Osnove fotografije in videosnemanja -Tekmovanja -========== - -* 2023-10: Udeležil sem se tekmovanja [ECSC](http://ecsc.no) na Norveškem v slovenski reprezentanci. -* Enkrat prvo in enkrat drugo mesto na [računalniškem tekmovanju ACM](http://rtk.ijs.si) ter srebrno priznanje na računalniškem tekmovanju ZOTKS - -Raziskovalno delo -================= - -* [Pridobivanje podatkov iz omrežja DHT, 2023](https://plus.cobiss.net/cobiss/si/sl/bib/163807491) -- COBISS.SI ID 163807491 pdf: <http://splet.sijanec.eu./dir/kon%C4%8Dna.pdf> - Hobiji ====== @@ -84,5 +86,5 @@ Poleg zgoraj naštetega sem od 5. 2022 radioamater in član Radiokluba Triglav. Meta ==== -* Življenjepis nazadnje spremenjen 2024-07-05 -* Aktualna različica: <http://upload.sijanec.eu./d/cv.pdf> +* Življenjepis nazadnje spremenjen 2024-10-15 +* Aktualna različica: <http://splet.sijanec.eu./dir/cv.pdf> diff --git a/skripti/fienta_availability.sh b/skripti/fienta_availability.sh new file mode 100755 index 0000000..79018ee --- /dev/null +++ b/skripti/fienta_availability.sh @@ -0,0 +1,44 @@ +#!/bin/bash +set -e +if [ x$1 = x ] +then + echo uporaba: $0 spoznavni-zur-fri [sekund] >&2 + echo če je 2. argument nastavljen, program ne exita in v neskončnost piše timestampane podatke o zasedenosti, sicer outputa samo enkrat podatke o zasedenosti brez timestampov >&2 + echo če sta prvi argument dve mali črki, se izpišejo prosta mesta za vse evente v državi s to kodo države >&2 + exit 1 +fi +fienta_availability() { + p=`rev <<<$0 | cut -d/ -f1 | rev` + t=`mktemp -p "" $p.XXX` + page=`curl --no-progress-meter --fail-with-body --cookie $t --cookie-jar $t https://fienta.com/$1` + token=`tr '<' $'\n' <<<$page | grep _token | cut -d\" -f6` + items=`grep -o 'data-id="[0-9]*"' <<<$page | cut -d \" -f2` + postbody=`for item in $items; do echo -n "&qty%5B$item%5D=1000000"; done` + curl --no-progress-meter --cookie $t --cookie-jar $t https://fienta.com/$1 -X POST -H 'X-Requested-With: XMLHttpRequest' --data-raw "_token=$token$postbody" | tr ']' $'\n' | grep "availability has been changed" | sed -E 's/.*"qty.([0-9]*)":."Sorry, \\"(.*)\\" availability has been changed meanwhile. We only have ([0-9]*) places* left.*/\1\t\2\t\3/g' + rm $t +} +fienta_all() { + all=`curl --no-progress-meter --fail-with-body https://fienta.com/?country=$1 | grep ?utm_source=fienta-search | grep -v /s/ | cut -d/ -f4 | cut -d? -f1 | tr $'\n' ' '` + for slug in $all + do + fienta_availability $slug | sed -e "s/^/$slug\t/" + done +} +fienta_entry() { + if [ `wc -c <<<$1` -eq 3 ] + then + fienta_all $1 + else + fienta_availability $1 + fi +} +if [ x$2 = x ] +then + fienta_entry $1 +else + while : + do + fienta_entry $1 | sed -e "s/^/`date +%s`\t/" + sleep $2 + done +fi diff --git a/skripti/spotify_publish_saved.py b/skripti/spotify_publish_saved.py new file mode 100755 index 0000000..a7f737a --- /dev/null +++ b/skripti/spotify_publish_saved.py @@ -0,0 +1,43 @@ +#!/usr/bin/python3 +import spotipy +from spotipy.oauth2 import SpotifyOAuth +import json +import sys +import datetime +scope = "user-library-read playlist-modify-public" +sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope, client_id="1034e542fa064c27859b61a6ec5f864e", client_secret="2503172e78ce4d5e9146047db0a39077", redirect_uri="http://b.4a.si:25425/")) +for playlist, rev in [("0ASvlSEvlQu5nyFwUZqf9n", False), ("4B9TSgOGQRRvFtOnQav42J", True)]: + publicized_uris = [] + results = {"items": [None]} + offset = 0 + while len(results["items"]) != 0: + results = sp.playlist_items(playlist, None, 100, offset) + for idx, item in enumerate(results["items"]): + publicized_uris.append(item["track"]["uri"]) + offset += 100 + results = {"items": [None]} + offset = 0 + saved_items = [] + to_add = [] + while len(results["items"]) != 0: + results = sp.current_user_saved_tracks(50, offset) + for idx, item in enumerate(results['items']): + saved_items.append(item) + if item["track"]["uri"] not in publicized_uris: + to_add.append(item["track"]["uri"]) + else: + publicized_uris.remove(item["track"]["uri"]) + offset += 50 + if rev == False: + to_add.reverse() + if len(to_add) != 0: + iterator = [to_add[i:i+50] for i in range(0, len(to_add), 50)] + if rev: + iterator = reversed(iterator) + for batch in iterator: + sp.playlist_add_items(playlist, batch, 0 if rev else None) + if len(publicized_uris) != 0: + sp.playlist_remove_all_occurrences_of_items(playlist, publicized_uris) + todaystring = datetime.datetime.now().isoformat().replace("T", " ").split(".")[0] + sp.playlist_change_details(playlist, name="public mirror of my liked songs." + " [REVERSED]" if rev else "", public=True, collaborative=False, description=f"updated {todaystring} automatically daily using http://4a.si/spotsync") + print(json.dumps(saved_items)) diff --git a/šola/ana1/kolokvij2.lyx b/šola/ana1/kolokvij2.lyx index a057288..4d94e99 100644 --- a/šola/ana1/kolokvij2.lyx +++ b/šola/ana1/kolokvij2.lyx @@ -1,5 +1,5 @@ -#LyX 2.3 created this file. For more info see http://www.lyx.org/ -\lyxformat 544 +#LyX 2.4 created this file. For more info see https://www.lyx.org/ +\lyxformat 620 \begin_document \begin_header \save_transient_properties true @@ -17,11 +17,11 @@ enumitem theorems-ams \end_modules -\maintain_unincluded_children false +\maintain_unincluded_children no \language slovene \language_package default -\inputencoding auto -\fontencoding global +\inputencoding auto-legacy +\fontencoding auto \font_roman "default" "default" \font_sans "default" "default" \font_typewriter "default" "default" @@ -29,7 +29,9 @@ theorems-ams \font_default_family default \use_non_tex_fonts false \font_sc false -\font_osf false +\font_roman_osf false +\font_sans_osf false +\font_typewriter_osf false \font_sf_scale 100 100 \font_tt_scale 100 100 \use_microtype false @@ -63,7 +65,9 @@ theorems-ams \suppress_date false \justification false \use_refstyle 1 +\use_formatted_ref 0 \use_minted 0 +\use_lineno 0 \index Index \shortcut idx \color #008000 @@ -86,42 +90,20 @@ theorems-ams \papercolumns 1 \papersides 1 \paperpagestyle default +\tablestyle default \tracking_changes false \output_changes false +\change_bars false +\postpone_fragile_content false \html_math_output 0 \html_css_as_file 0 \html_be_strict false +\docbook_table_output 0 +\docbook_mathml_prefix 1 \end_header \begin_body -\begin_layout Title -List s formulami za 2. - kolokvij Analize 1 -\end_layout - -\begin_layout Author - -\noun on -Anton Luka Šijanec -\end_layout - -\begin_layout Date -\begin_inset ERT -status open - -\begin_layout Plain Layout - - -\backslash -today -\end_layout - -\end_inset - - -\end_layout - \begin_layout Standard \begin_inset ERT status open @@ -161,15 +143,18 @@ begin{multicols}{2} \begin_inset Formula $\log_{a}1=0$ \end_inset -, +, + \begin_inset Formula $\log_{a}a=1$ \end_inset -, +, + \begin_inset Formula $\log_{a}a^{x}=x$ \end_inset -, +, + \begin_inset Formula $a^{\log_{a}x}=x$ \end_inset @@ -187,7 +172,8 @@ begin{multicols}{2} \begin_inset Formula $D=b^{2}-4ac$ \end_inset -, +, + \begin_inset Formula $x_{1,2}=\frac{-b\pm\sqrt{D}}{2a}$ \end_inset @@ -205,7 +191,8 @@ begin{multicols}{2} \begin_inset Formula $zw=\left(ac-bd\right)+\left(ad+bc\right)i$ \end_inset -, +, + \begin_inset Formula $\vert zw\vert=\vert z\vert\vert w\vert$ \end_inset @@ -241,7 +228,8 @@ begin{multicols}{2} \begin_inset Formula $z^{2}=a^{2}+2abi-b^{2}$ \end_inset -, +, + \begin_inset Formula $z^{3}=a^{3}-3ab^{2}+\left(3a^{2}b-b^{3}\right)i$ \end_inset @@ -259,7 +247,8 @@ begin{multicols}{2} \begin_inset Formula $z^{n}=r^{3}\left(\cos\left(3\phi\right)+i\sin\left(3\phi\right)\right)$ \end_inset -, +, + \begin_inset Formula $\phi=\arctan\frac{\Im z}{\Re z}$ \end_inset @@ -316,7 +305,8 @@ je konv. \end_layout \begin_layout Standard -Vrsta je konv., če je konv. +Vrsta je konv., + če je konv. njeno zap. delnih vsot. \end_layout @@ -343,7 +333,8 @@ n+1; & q=1 \series bold Primerjalni krit. \series default -: +: + \begin_inset Formula $\sum_{1}^{\infty}a_{k}$ \end_inset @@ -389,11 +380,13 @@ majoranta \series bold Kvocientni \series default -: +: + \begin_inset Formula $a_{k}>0$ \end_inset -, +, + \begin_inset Formula $D_{n}\coloneqq\frac{a_{n}+1}{a_{n}}$ \end_inset @@ -419,11 +412,13 @@ Kvocientni \begin_inset Formula $\exists D\coloneqq\lim_{n\to\infty}D_{n}$ \end_inset -: +: + \begin_inset Formula $\vert D\vert<1\Longrightarrow$ \end_inset -konv., +konv., + \begin_inset Formula $\vert D\vert>1\Longrightarrow div.$ \end_inset @@ -435,7 +430,9 @@ konv., \series bold Korenski \series default -: Kot Kvocientni, le da +: + Kot Kvocientni, + le da \begin_inset Formula $D_{n}\coloneqq\sqrt[n]{a_{n}}$ \end_inset @@ -447,7 +444,8 @@ Korenski \series bold Leibnizov \series default -: +: + \begin_inset Formula $a_{n}\to0\Longrightarrow\sum_{1}^{\infty}\left(\left(-1\right)^{k}a_{k}\right)<\infty$ \end_inset @@ -476,11 +474,13 @@ Pri konv. \begin_inset Formula $x$ \end_inset -, pri enakomerni ni. +, + pri enakomerni ni. \end_layout \begin_layout Standard -Potenčna vrsta: +Potenčna vrsta: + \begin_inset Formula $\sum_{j=1}^{\infty}b_{j}x^{j}$ \end_inset @@ -495,7 +495,8 @@ Potenčna vrsta: \end_inset abs. - konv., + konv., + \begin_inset Formula $\vert x\vert>R\Longrightarrow$ \end_inset @@ -719,7 +720,8 @@ divergira \end_layout \begin_layout Standard -Krožnica: +Krožnica: + \begin_inset Formula $\left(x-p\right)^{2}+\left(y-q\right)^{2}=r^{2}$ \end_inset @@ -727,7 +729,8 @@ Krožnica: \end_layout \begin_layout Standard -Elipsa: +Elipsa: + \begin_inset Formula $\frac{\left(x-p\right)^{2}}{a^{2}}+\frac{\left(y-q\right)^{2}}{b^{2}}=1$ \end_inset @@ -800,7 +803,8 @@ Odvod \begin_inset Formula $\frac{f'g-fg'}{g^{2}}$ \end_inset -, +, + \begin_inset Formula $g\not=0$ \end_inset @@ -1260,7 +1264,8 @@ Zvezna \begin_inset Formula $\sup$ \end_inset -, je omejena in doseže vse funkcijske vrednosti na +, + je omejena in doseže vse funkcijske vrednosti na \begin_inset Formula $\left[f\left(a\right),f\left(b\right)\right]$ \end_inset @@ -1275,7 +1280,8 @@ Zvezna \begin_inset Formula $I$ \end_inset -, če +, + če \begin_inset Formula $\forall\varepsilon>0\exists\delta_{\left(\varepsilon\right)}>0\ni:\forall x,y\in I:\left|x-y\right|<\delta\Rightarrow\left|f\left(x\right)-f\left(y\right)\right|<\varepsilon$ \end_inset @@ -1290,7 +1296,8 @@ Zvezna \begin_inset Formula $I$ \end_inset -, če +, + če \begin_inset Formula $\forall\varepsilon>0\forall x\in I\exists\delta_{\left(x,\varepsilon\right)}>0\ni:\forall x,y\in I:\left|x-y\right|<\delta\Rightarrow\left|f\left(x\right)-f\left(y\right)\right|<\varepsilon$ \end_inset diff --git a/šola/ana1/teor3.lyx b/šola/ana1/teor3.lyx index 107763e..97befd1 100644 --- a/šola/ana1/teor3.lyx +++ b/šola/ana1/teor3.lyx @@ -1,4 +1,4 @@ -#LyX 2.4 created this file. For more info see https://www.lyx.org/ +#LyX 2.3 created this file. For more info see http://www.lyx.org/ \lyxformat 544 \begin_document \begin_header @@ -76,14 +76,22 @@ \begin_body \begin_layout Title -Rešen tretji izpit teorije Analize 1 — - IŠRM 2023/24 +Rešen tretji izpit teorije Analize 1 — IŠRM 2023/24 \end_layout \begin_layout Abstract -Izpit je potekal v petek, - 30. - avgusta 2024. +Izpit je potekal v petek, 30. + avgusta 2024 od desete +\begin_inset Foot +status open + +\begin_layout Plain Layout +Avtor tega besedila je na izpit zamudil poldrugo uro. +\end_layout + +\end_inset + + do dvanajste ure. Nosilec predmeta je \noun on Oliver Dragičević @@ -109,46 +117,429 @@ Podaj natančne definicije naslednjih pojmov: \begin_deeper \begin_layout Enumerate -limita zaporedja, - stekališče zaporedja +limita zaporedja, stekališče zaporedja +\end_layout + +\begin_deeper +\begin_layout Standard +Naj bo +\begin_inset Formula $\left(a_{n}\right)_{n\in\mathbb{N}}$ +\end_inset + + realno zaporedje in +\begin_inset Formula $L\in\mathbb{R}$ +\end_inset + +. +\end_layout + +\begin_layout Enumerate +\begin_inset Formula $L$ +\end_inset + + je limita +\begin_inset Formula $\left(a_{n}\right)_{n\in\mathbb{N}}\sim L=\lim_{n\to\infty}a_{n}\Leftrightarrow\forall\varepsilon>0\exists n_{0}\in\mathbb{N}\forall n>n_{0}:\left|a_{n}-L\right|<\varepsilon$ +\end_inset + +. +\end_layout + +\begin_layout Enumerate +\begin_inset Formula $L$ +\end_inset + + je stekališče +\begin_inset Formula $\left(a_{n}\right)_{n\in\mathbb{N}}\Leftrightarrow\forall\varepsilon>0\exists\mathcal{A}\subseteq\mathbb{N},\left|\mathcal{A}\right|=\left|\mathcal{\mathbb{N}}\right|\ni:\left\{ a_{n};n\in\mathcal{A}\right\} \subseteq\left(L-\varepsilon,L+\varepsilon\right)$ +\end_inset + + \end_layout +\end_deeper \begin_layout Enumerate vsota (neskončne) konvergentne vrste \end_layout +\begin_deeper +\begin_layout Standard +Naj bo +\begin_inset Formula $\left(a_{n}\right)_{n\in\mathbb{N}}$ +\end_inset + + poljubno zaporedje. + +\begin_inset Formula $\sum_{n=1}^{\infty}a_{n}\coloneqq\lim_{n\to\infty}\sum_{k=1}^{n}a_{n}$ +\end_inset + +. + Če limita obstaja, je vrsta +\begin_inset Formula $\sum_{n=1}^{\infty}a_{n}$ +\end_inset + + konvergentna in njena vsota je enaka tej limiti. +\end_layout + +\end_deeper \begin_layout Enumerate Cauchyjev pogoj za zaporedja \end_layout +\begin_deeper +\begin_layout Standard +Naj bo +\begin_inset Formula $\left(a_{n}\right)_{n\in\mathbb{N}}$ +\end_inset + + realno zaporedje. + Konvergentno je natanko tedaj, ko ustreza Cauchyjevemu pogoju: +\begin_inset Formula $\forall\varepsilon>0\exists n_{0}\in\mathbb{N}\forall m,n\geq n_{0}:\left|a_{n}-a_{m}\right|<\varepsilon$ +\end_inset + +. +\end_layout + +\end_deeper \begin_layout Enumerate -odprte, - zaprte, - omejene, - kompaktne množice v +odprte, zaprte, omejene, kompaktne množice v \begin_inset Formula $\mathbb{R}$ \end_inset \end_layout +\begin_deeper +\begin_layout Enumerate +Množica +\begin_inset Formula $\mathcal{A}$ +\end_inset + + je odprta, ko +\begin_inset Formula $\forall a\in\mathcal{A}\exists\varepsilon>0\ni:\left(a-\varepsilon,a+\varepsilon\right)\subseteq\mathcal{A}$ +\end_inset + +, ko za vsako točko množice obstaja neka njena okolica, ki je podmnožica + množice +\begin_inset Formula $\mathcal{A}$ +\end_inset + +. +\end_layout + +\begin_layout Enumerate +Množica +\begin_inset Formula $\mathcal{A}$ +\end_inset + + je zaprta, ko je +\begin_inset Formula $\mathcal{A}^{\mathcal{C}}\coloneqq\mathbb{R}\setminus\mathcal{A}$ +\end_inset + + odprta. +\end_layout + +\begin_layout Enumerate +Množica +\begin_inset Formula $\mathcal{A}$ +\end_inset + + je omejena, ko +\begin_inset Formula $\exists m,M\in\mathbb{R}\forall a\in\mathcal{A}:a\leq M\wedge a\geq m$ +\end_inset + +. +\end_layout + +\begin_layout Enumerate +Množica +\begin_inset Formula $\mathcal{A}$ +\end_inset + + je kompaktna +\begin_inset Formula $\Leftrightarrow\mathcal{A}$ +\end_inset + + zaprta +\begin_inset Formula $\wedge$ +\end_inset + + +\begin_inset Formula $\mathcal{A}$ +\end_inset + + omejena. +\end_layout + +\end_deeper \begin_layout Enumerate limita funkcije v dani točki \end_layout +\begin_deeper +\begin_layout Standard +Naj bodo +\begin_inset Formula $a\in\mathbb{R}$ +\end_inset + +, +\begin_inset Formula $\mathcal{D}$ +\end_inset + + okolica +\begin_inset Formula $a$ +\end_inset + + in +\begin_inset Formula $f:\mathcal{D}\setminus\left\{ a\right\} \to\mathbb{R}$ +\end_inset + + poljubne. + +\begin_inset Formula $L\in\mathbb{R}$ +\end_inset + + je limita +\begin_inset Formula $f$ +\end_inset + + v točki +\begin_inset Formula $a\sim L=\lim_{x\to a}f\left(x\right)\Leftrightarrow\forall\varepsilon>0\exists\delta>0\forall x\in\mathcal{D}\setminus\left\{ a\right\} :\left|x-a\right|<\delta\Rightarrow\left|f\left(x\right)-L\right|<\varepsilon$ +\end_inset + +. +\end_layout + +\end_deeper \begin_layout Enumerate zveznost funkcije \end_layout +\begin_deeper +\begin_layout Standard +Naj bodo +\begin_inset Formula $\mathcal{D}\subseteq\mathbb{R}$ +\end_inset + +, +\begin_inset Formula $a\in\mathcal{D}$ +\end_inset + + in +\begin_inset Formula $f:\mathcal{D}\to\mathbb{R}$ +\end_inset + + poljubne. + +\begin_inset Formula $f$ +\end_inset + + je zvezna v +\begin_inset Formula $a\Leftrightarrow\forall\varepsilon>0\exists\delta>0\forall x\in\mathcal{D}:\left|x-a\right|<\delta\Rightarrow\left|f\left(x\right)-f\left(a\right)\right|<\varepsilon$ +\end_inset + + . + +\begin_inset Formula $f$ +\end_inset + + je zvezna na množici +\begin_inset Formula $\mathcal{A}$ +\end_inset + +, če je zvezna na vsaki točki množice +\begin_inset Formula $\mathcal{A}$ +\end_inset + +. +\end_layout + +\end_deeper \begin_layout Enumerate odvedljivost funkcije \end_layout +\begin_deeper +\begin_layout Standard +Naj bodo +\begin_inset Formula $a\in\mathbb{R}$ +\end_inset + +, +\begin_inset Formula $\mathcal{D}\subseteq\mathbb{R}$ +\end_inset + +, +\begin_inset Formula $f:\mathcal{D}\to\mathbb{R}$ +\end_inset + + poljubne. + +\begin_inset Formula $f$ +\end_inset + + je odvedljiva v +\begin_inset Formula $a\text{\ensuremath{\Leftrightarrow\lim_{h\to0}\frac{f\left(a+h\right)-f\left(a\right)}{h}}}\in\mathbb{R}$ +\end_inset + +, ZDB ko obstaja slednja limita. + Tedaj definiramo +\begin_inset Quotes eld +\end_inset + +odvod funkcije +\begin_inset Formula $f$ +\end_inset + + v točki +\begin_inset Formula $a$ +\end_inset + + +\begin_inset Quotes erd +\end_inset + +: +\begin_inset Formula $f'\left(a\right)=\lim_{h\to0}\frac{f\left(a+h\right)-f\left(a\right)}{h}$ +\end_inset + +. + +\begin_inset Formula $f$ +\end_inset + + je odvedljiva na množici +\begin_inset Formula $\mathcal{A}$ +\end_inset + +, če je odvedljiva na vsaki točki množice +\begin_inset Formula $\mathcal{A}$ +\end_inset + +. +\end_layout + +\end_deeper +\begin_layout Enumerate +določen integral realne funkcije na zaprtem omejenem intervalu. +\end_layout + +\begin_deeper +\begin_layout Enumerate +Naj bodo +\begin_inset Formula $a,b\in\mathbb{R}$ +\end_inset + + in +\begin_inset Formula $f:\left[a,b\right]\to\mathbb{R}$ +\end_inset + + poljubne. +\end_layout + +\begin_layout Enumerate +Definirajmo pojem delitve +\begin_inset Formula $\left[a,b\right]$ +\end_inset + +. + Delitev so točke +\begin_inset Formula $t_{0},\dots,t_{n}$ +\end_inset + +, da velja +\begin_inset Formula $a=t_{0}<t_{1}<\cdots<t_{n}=b$ +\end_inset + + za nek +\begin_inset Formula $n\in\mathbb{N}$ +\end_inset + +. + Točke identificiramo z delilnimi intervali takole: +\begin_inset Formula $D_{n}=\left[t_{n-1},t_{n}\right]$ +\end_inset + +. + Delitev torej identificiramo z množico teh dedlilnih intervalov: +\begin_inset Formula $D=\left\{ D_{k};\forall k\in\left\{ 1..n\right\} \right\} $ +\end_inset + +. + Definiramo tudi velikost delitve: +\begin_inset Formula $\left|D_{\infty}\right|=\max_{k\in\left\{ 1..n\right\} }\left|D_{k}\right|$ +\end_inset + +. +\end_layout + +\begin_layout Enumerate +Definirajmo pojem izbire za dano delitev. + Naj bo +\begin_inset Formula $D$ +\end_inset + + delitev. + Pripadajoča izbira so take izbirne točke +\begin_inset Formula $\xi_{1},\dots,\xi_{n}$ +\end_inset + +, da velja +\begin_inset Formula $\forall k\in\left\{ 1..n\right\} :\xi_{k}\in D_{k}$ +\end_inset + +. + Množico teh izbirnih točk označimo z +\begin_inset Formula $\xi\coloneqq\left\{ \xi_{k};\forall k\in\left\{ 1..n\right\} \right\} $ +\end_inset + +. +\end_layout + \begin_layout Enumerate -določeni integral realne funkcije na zaprtem omejenem intervalu. +\begin_inset Formula $f$ +\end_inset + + je integrabilna na +\begin_inset Formula $\left[a,b\right]$ +\end_inset + +, če +\begin_inset Formula $\exists I\in\mathbb{R}\forall\varepsilon>0\exists\delta>0\forall$ +\end_inset + + delitev +\begin_inset Formula $D\forall$ +\end_inset + + izbiro +\begin_inset Formula $\xi$ +\end_inset + +, pripadajočo delitvi +\begin_inset Formula $D:\left|D_{\infty}\right|<\delta\Rightarrow\left|\sum_{k=1}^{n}\left|D_{k}\right|f\left(\xi\right)-I\right|<\varepsilon$ +\end_inset + +. + Tedaj pravimo, da je +\begin_inset Formula $I$ +\end_inset + + določen integral +\begin_inset Formula $f$ +\end_inset + + na +\begin_inset Formula $\left[a,b\right]$ +\end_inset + + in pišemo +\begin_inset Formula $I\eqqcolon\int_{a}^{b}f\left(x\right)dx$ +\end_inset + +. \end_layout \end_deeper +\end_deeper \begin_layout Enumerate \begin_inset Formula $\left[15\right]$ \end_inset @@ -161,11 +552,177 @@ določeni integral realne funkcije na zaprtem omejenem intervalu. Pojasni princip matematične indukcije. \end_layout +\begin_deeper +\begin_layout Standard +Naj bo +\begin_inset Formula $\left(P_{n}\right)_{n\in\mathbb{N}}$ +\end_inset + + zaporedje logičnih vrednosti/izjav/izrazov. + Če velja +\end_layout + +\begin_layout Enumerate +\begin_inset Formula $P_{1}$ +\end_inset + + drži in hkrati +\end_layout + +\begin_layout Enumerate +\begin_inset Formula $\forall n\in\mathbb{N}:P_{n}$ +\end_inset + + drži +\begin_inset Formula $\Rightarrow P_{n+1}$ +\end_inset + + drži, +\end_layout + +\begin_layout Standard +potem velja +\begin_inset Formula $\forall n\in\mathbb{N}:P_{n}$ +\end_inset + + drži. +\end_layout + +\end_deeper \begin_layout Enumerate Z matematično indukcijo dokaži \begin_inset Formula \[ -1+2+\cdots+n=\frac{n\left(n+1\right)}{2} +\forall n\in\mathbb{N}:1+2+\cdots+n=\frac{n\left(n+1\right)}{2} +\] + +\end_inset + + +\end_layout + +\begin_deeper +\begin_layout Enumerate +Baza +\begin_inset Formula $n=1$ +\end_inset + +: +\begin_inset Formula $1=\frac{1\left(1+1\right)}{2}$ +\end_inset + + Velja. +\end_layout + +\begin_layout Enumerate +Indukcijska predpostavka: +\begin_inset Formula $1+2+\cdots+n=\frac{n\left(n+1\right)}{2}$ +\end_inset + +. +\end_layout + +\begin_layout Enumerate +Korak +\begin_inset Formula $n\to n+1$ +\end_inset + +: +\begin_inset Formula +\[ +1+2+\cdots+n+\cancel{n+1}\overset{?}{=}\frac{\left(n+1\right)\left(n+1+1\right)}{2}=\frac{n^{2}+2n+n+2}{2}=\frac{n\left(n+1\right)}{2}+\cancel{n+1} +\] + +\end_inset + + +\begin_inset Formula +\[ +1+2+\cdots+n\overset{\text{I.P.}}{=}\frac{n\left(n+1\right)}{2} +\] + +\end_inset + + +\end_layout + +\begin_layout Enumerate +Sklep: +\begin_inset Formula $\forall n\in\mathbb{N}:1+2+\cdots+n=\frac{n\left(n+1\right)}{2}$ +\end_inset + +. +\end_layout + +\end_deeper +\end_deeper +\begin_layout Enumerate +\begin_inset Formula $\left[25\right]$ +\end_inset + + +\begin_inset Newline newline +\end_inset + +Naj bosta +\begin_inset Formula $\left(a_{n}\right)_{n\in\mathbb{N}}$ +\end_inset + + in +\begin_inset Formula $\left(b_{n}\right)_{n\in\mathbb{N}}$ +\end_inset + + realni konvergentni zaporedji. + Dokaži, da je +\begin_inset Formula $c_{n}\coloneqq a_{n}b_{n}$ +\end_inset + + prav tako konvergentno zaporedje. +\end_layout + +\begin_deeper +\begin_layout Itemize +Označimo +\begin_inset Formula $\lim_{n\to\infty}a_{n}\eqqcolon A$ +\end_inset + + in +\begin_inset Formula $\lim_{n\to\infty}b_{n}\eqqcolon B$ +\end_inset + +. +\end_layout + +\begin_layout Itemize +Uganemo, da je +\begin_inset Formula $\lim_{n\to\infty}a_{n}b_{n}=AB$ +\end_inset + +. + To moramo sedaj dokazati. +\end_layout + +\begin_layout Itemize +Dokazujemo, da +\begin_inset Formula $\forall\varepsilon>0\exists n_{0}\in\mathbb{N}\forall n\geq n_{0}:\left|a_{n}b_{n}-AB\right|<\varepsilon\sim\left|a_{n}b_{n}+a_{n}B-a_{n}B-AB\right|=\left|a_{n}\left(b_{n}-B\right)+B\left(a_{n}-A\right)\right|<\varepsilon$ +\end_inset + + +\end_layout + +\begin_layout Itemize +Ker po trikotniški neenakosti velja +\begin_inset Formula $\left|a_{n}\left(b_{n}-B\right)+B\left(a_{n}-A\right)\right|\leq\left|a_{n}\right|\left|b_{n}-B\right|+\left|B\right|\left|a_{n}-A\right|$ +\end_inset + +, je dovolj za poljuben +\begin_inset Formula $\varepsilon>0$ +\end_inset + + dokazati +\begin_inset Formula +\[ +\exists n_{0}\in\mathbb{N}\forall n\geq n_{0}:\left|a_{n}\right|\left|b_{n}-B\right|+\left|B\right|\left|a_{n}-A\right|<\varepsilon \] \end_inset @@ -173,10 +730,509 @@ Z matematično indukcijo dokaži \end_layout +\begin_layout Itemize +Ker je +\begin_inset Formula $\left(a_{n}\right)_{n\in\mathbb{N}}$ +\end_inset + + konvergentno, +\begin_inset Formula $\exists n_{1}\in\mathbb{N}\forall n\geq n_{1}:\left|a_{n}-A\right|<\frac{\varepsilon}{2\left|a\right|}$ +\end_inset + +, kjer je +\begin_inset Formula $a$ +\end_inset + + zgornja meja zaporedja +\begin_inset Formula $a_{n}$ +\end_inset + +. + Slednje je omejeno, ker je konvergentno. +\end_layout + +\begin_layout Itemize +Ker je +\begin_inset Formula $\left(b_{n}\right)_{n\in\mathbb{N}}$ +\end_inset + + konvergentno, +\begin_inset Formula $\exists n_{2}\in\mathbb{N}\forall n\geq n_{1}:\left|b_{n}-B\right|<\frac{\varepsilon}{2\left|B\right|}$ +\end_inset + +. +\end_layout + +\begin_layout Itemize +Tedaj za +\begin_inset Formula $n_{0}\coloneqq\max\left\{ n_{1},n_{2}\right\} $ +\end_inset + + velja +\begin_inset Formula +\[ +\left|a_{n}\right|\left|b_{n}-B\right|+\left|B\right|\left|a_{n}-A\right|<\frac{\varepsilon\left|a\right|}{2\left|a_{n}\right|}+\frac{\varepsilon}{2}\leq\frac{\varepsilon}{2}+\frac{\varepsilon}{2}=\varepsilon +\] + +\end_inset + +in izrek je dokazan. +\end_layout + \end_deeper \begin_layout Enumerate -Naj bo +\begin_inset Formula $\left[?\right]$ +\end_inset + + +\begin_inset Newline newline +\end_inset + +Dokaži, da je zvezna realna funkcija na zaprtem intervalu omejena. + Natančno navedi vse izreke, ki jih pri tem dokazu uporabiš. +\end_layout + +\begin_deeper +\begin_layout Standard +Naj bodo +\begin_inset Formula $a,b\in\mathbb{R}$ +\end_inset + + in zvezna +\begin_inset Formula $f:\left[a,b\right]\to\mathbb{R}$ +\end_inset + + poljubne. +\end_layout + +\begin_layout Itemize +Dokaz, da je +\begin_inset Formula $f$ +\end_inset + + omejena navzgor. +\end_layout + +\begin_deeper +\begin_layout Itemize +PDDRAA +\begin_inset Formula $f$ +\end_inset + + ni navzgor omejena. + Tedaj +\begin_inset Formula $\forall n\in\mathbb{N}\exists x_{n}\in\left[a,b\right]\ni:f\left(x_{n}\right)\geq n$ +\end_inset + +. \end_layout +\begin_layout Itemize +Ker je +\begin_inset Formula $\left(a_{n}\right)_{n\in\mathbb{N}}$ +\end_inset + + na zaprti množici, je omejeno zaporedje, torej ima stekališče. + Recimo mu +\begin_inset Formula $s\in\mathbb{R}$ +\end_inset + +. +\end_layout + +\begin_layout Itemize +Ker je +\begin_inset Formula $\left[a,b\right]$ +\end_inset + + zaprta, je +\begin_inset Formula $s\in\left[a,b\right]$ +\end_inset + +. +\end_layout + +\begin_layout Itemize +Ker je +\begin_inset Formula $f$ +\end_inset + + zvezna na +\begin_inset Formula $\left[a,b\right]$ +\end_inset + + in s tem v +\begin_inset Formula $s$ +\end_inset + +, velja +\begin_inset Formula $\lim_{n\to\infty}f\left(x_{n}\right)=f\left(s\right)$ +\end_inset + +. +\end_layout + +\begin_layout Itemize +Po konstrukciji +\begin_inset Formula $\left(x_{n}\right)_{n\in\mathbb{N}}$ +\end_inset + + velja +\begin_inset Formula $\lim_{n\to\infty}f\left(x_{n}\right)=\infty$ +\end_inset + +, torej +\begin_inset Formula $f\left(s\right)=\infty$ +\end_inset + +, kar ni mogoče, saj +\begin_inset Formula $f\left(s\right)\in\mathbb{R}$ +\end_inset + + po predpostavki. + +\begin_inset Formula $\rightarrow\!\leftarrow$ +\end_inset + +. +\end_layout + +\begin_layout Standard +Predpostavka +\begin_inset Quotes eld +\end_inset + + +\begin_inset Formula $f$ +\end_inset + + ni navzgor omejena +\begin_inset Quotes erd +\end_inset + + ne velja, torej smo dokazali, da je +\begin_inset Formula $f$ +\end_inset + + navzgor omejena. +\end_layout + +\end_deeper +\begin_layout Itemize +Dokaz, da je +\begin_inset Formula $f$ +\end_inset + + omejena navzdol. +\end_layout + +\begin_deeper +\begin_layout Itemize +PDDRAA +\begin_inset Formula $f$ +\end_inset + + ni navzdol omejena. + Tedaj +\begin_inset Formula $\forall n\in\mathbb{N}\exists x_{n}\in\left[a,b\right]\ni:f\left(x_{n}\right)\leq-n$ +\end_inset + +. +\end_layout + +\begin_layout Itemize +Ker je +\begin_inset Formula $\left(a_{n}\right)_{n\in\mathbb{\mathbb{N}}}$ +\end_inset + + na zaprti množici, je omejeno zaporedje, torej ima stekališče. + Recimo mu +\begin_inset Formula $s\in\mathbb{R}$ +\end_inset + +. +\end_layout + +\begin_layout Itemize +Ker je +\begin_inset Formula $\left[a,b\right]$ +\end_inset + + zaprta, je +\begin_inset Formula $s\in\left[a,b\right]$ +\end_inset + +. +\end_layout + +\begin_layout Itemize +Ker je +\begin_inset Formula $f$ +\end_inset + + zvezna na +\begin_inset Formula $\left[a,b\right]$ +\end_inset + + in s tem v +\begin_inset Formula $s$ +\end_inset + +, velja +\begin_inset Formula $\lim_{n\to\infty}f\left(x_{n}\right)=f\left(s\right)$ +\end_inset + +. +\end_layout + +\begin_layout Itemize +Po konstrukciji +\begin_inset Formula $\left(x_{n}\right)_{n\in\mathbb{N}}$ +\end_inset + + velja +\begin_inset Formula $\lim_{n\to\infty}f\left(x_{n}\right)=-\infty$ +\end_inset + +, torej +\begin_inset Formula $f\left(s\right)=-\infty$ +\end_inset + +, kar ni mogoče, saj +\begin_inset Formula $f\left(s\right)\in\mathbb{R}$ +\end_inset + + po predpostavki. + +\begin_inset Formula $\rightarrow\!\leftarrow$ +\end_inset + +. +\end_layout + +\begin_layout Standard +Predpostavka +\begin_inset Quotes eld +\end_inset + + +\begin_inset Formula $f$ +\end_inset + + ni navzdol omejena +\begin_inset Quotes erd +\end_inset + + ne velja, torej smo dokazali, da je +\begin_inset Formula $f$ +\end_inset + + navzdol omejena. +\end_layout + +\end_deeper +\begin_layout Itemize +Ker je +\begin_inset Formula $f$ +\end_inset + + omejena navzgor in navzdol, je omejena. +\end_layout + +\begin_layout Itemize +Uporabljeni izreki. +\end_layout + +\begin_deeper +\begin_layout Itemize +Zaporedje +\begin_inset Formula $\left(a_{n}\right)_{n\in\mathbb{N}}$ +\end_inset + + s členi na kompaktni množici je omejeno. +\end_layout + +\begin_layout Itemize +Omejeno zaporedje ima stekališče. +\end_layout + +\begin_layout Itemize +Če je +\begin_inset Formula $s\in\mathbb{R}$ +\end_inset + + stekališče zaporedja +\begin_inset Formula $\left(a_{n}\right)_{n\in\mathbb{N}}$ +\end_inset + +, obstaja konvergentno podzaporedje +\begin_inset Formula $\left(a_{n_{k}}\right)_{k\in\mathbb{N}}$ +\end_inset + +, da je +\begin_inset Formula $s$ +\end_inset + + njegova limita. +\end_layout + +\begin_layout Itemize +Množica je kompaktna natanko tedaj, ko vsebuje limite vseh konvergentnih + zaporedij s členi v njej. +\end_layout + +\begin_layout Itemize +Funkcija +\begin_inset Formula $f$ +\end_inset + + je zvezna v +\begin_inset Formula $s$ +\end_inset + +, če za vsako k +\begin_inset Formula $s$ +\end_inset + + konvergentno zaporedje velja, da njegovi s +\begin_inset Formula $f$ +\end_inset + + preslikani členi konvergirajo v +\begin_inset Formula $f\left(s\right)$ +\end_inset + +. +\end_layout + +\end_deeper +\end_deeper +\begin_layout Enumerate +\begin_inset Formula $\left[?\right]$ +\end_inset + + +\begin_inset Newline newline +\end_inset + +Za realno funkcijo ene spremenljivke dokaži verižno pravilo. +\end_layout + +\begin_deeper +\begin_layout Itemize +Naj bodo +\begin_inset Formula $\mathcal{D},\mathcal{E},\mathcal{F}\subseteq\mathbb{R}$ +\end_inset + +, +\begin_inset Formula $x\in\mathcal{D}$ +\end_inset + + in +\begin_inset Formula $f:\mathcal{D}\to\mathcal{E}$ +\end_inset + +, +\begin_inset Formula $g:\mathcal{E}\to\mathcal{F}$ +\end_inset + + poljubne. + Naj bo +\begin_inset Formula $f$ +\end_inset + + odvedljiva v +\begin_inset Formula $x$ +\end_inset + + in +\begin_inset Formula $g$ +\end_inset + + odvedljiva v +\begin_inset Formula $f\left(x\right)$ +\end_inset + +. +\end_layout + +\begin_layout Itemize +Dokažimo, da je +\begin_inset Formula $g\circ f$ +\end_inset + + odvedljiva v +\begin_inset Formula $x$ +\end_inset + + in da velja +\begin_inset Formula +\[ +\left(g\circ f\right)'\left(x\right)=g'\left(f\left(x\right)\right)f'\left(x\right). +\] + +\end_inset + + +\end_layout + +\begin_layout Itemize +Označimo +\begin_inset Formula $a\coloneqq f\left(x\right)$ +\end_inset + + in +\begin_inset Formula $\delta_{h}\coloneqq f\left(x+h\right)-f\left(x\right)$ +\end_inset + +. + Potemtakem +\begin_inset Formula $f\left(x+h\right)=\delta_{h}+a$ +\end_inset + +. +\begin_inset Formula +\[ +\left(g\circ f\right)'\left(x\right)=\lim_{h\to0}\frac{g\left(f\left(x+h\right)\right)-g\left(f\left(x\right)\right)=g\left(\delta_{h}+a\right)-g\left(a\right)}{h}= +\] + +\end_inset + + +\begin_inset Formula +\[ +=\lim_{h\to0}\frac{g\left(\delta_{h}+a\right)-g\left(a\right)}{\delta_{h}}\cdot\frac{\delta_{h}}{h}=\lim_{h\to0}\frac{g\left(\delta_{h}+a\right)-g\left(a\right)}{\delta_{h}}\cdot\frac{f\left(x+h\right)-f\left(x\right)}{h}=\cdots +\] + +\end_inset + +Ker je +\begin_inset Formula $f$ +\end_inset + + v +\begin_inset Formula $x$ +\end_inset + + odvedljiva, je v +\begin_inset Formula $x$ +\end_inset + + zvezna, zato sledi +\begin_inset Formula $h\to0\Rightarrow\delta_{h}\to0$ +\end_inset + +. +\begin_inset Formula +\[ +\cdots=g'\left(a\right)\cdot f'\left(x\right)=g'\left(f\left(x\right)\right)\cdot f'\left(x\right) +\] + +\end_inset + + +\end_layout + +\end_deeper \end_body \end_document diff --git a/šola/aps1/dn/osvetlitev/Makefile b/šola/aps1/dn/osvetlitev/Makefile new file mode 100644 index 0000000..2d78386 --- /dev/null +++ b/šola/aps1/dn/osvetlitev/Makefile @@ -0,0 +1,4 @@ +program: resitev.cpp + g++ -Wall -Wextra -pedantic -Wformat-security -std=c++20 -o$@ $< +clean: + rm program diff --git a/šola/aps1/dn/osvetlitev/in.txt b/šola/aps1/dn/osvetlitev/in.txt new file mode 100644 index 0000000..76b90fe --- /dev/null +++ b/šola/aps1/dn/osvetlitev/in.txt @@ -0,0 +1,9 @@ +30 +7 +10 2 +23 2 +14 1 +4 1 +14 4 +11 5 +1 2 diff --git a/šola/aps1/dn/osvetlitev/resitev.cpp b/šola/aps1/dn/osvetlitev/resitev.cpp new file mode 100644 index 0000000..0a17f31 --- /dev/null +++ b/šola/aps1/dn/osvetlitev/resitev.cpp @@ -0,0 +1,46 @@ +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +struct event { + int pos; + bool tip; // true za začetek, false za konec +}; +int compar_events (const void * a, const void * b) { + if (((struct event *) a)->pos == ((struct event *) b)->pos) + return 0; + if (((struct event *) a)->pos < ((struct event *) b)->pos) + return -1; + return 1; +} +int main (void) { + struct event events[20000]; + int M, N, x, d; + scanf("%d %d", &M, &N); + for (int i = 0; i < N; i++) { + scanf("%d %d", &x, &d); + events[2*i].pos = x-d >= 0 ? x-d : 0; + events[2*i].tip = true; + events[2*i+1].pos = x+d <= M ? x+d : M; + events[2*i+1].tip = false; + } + qsort(events, 2*N, sizeof events[0], compar_events); + int osv = 0; + int depth = 0; + int start; + for (int i = 0; i < 2*N; i++) { + // fprintf(stderr, "pos=%d\ttip=%d\n", events[i].pos, events[i].tip); + if (events[i].tip == true) { + if (depth == 0) + start = events[i].pos; + depth++; + } + if (events[i].tip == false) { + depth--; + if (depth == 0) + osv += events[i].pos - start; + } + } + if (depth != 0) + fprintf(stderr, "depth == %d\n", depth); + printf("%d\n", M-osv); +} diff --git a/šola/aps1/dn/zlivanje/in.txt b/šola/aps1/dn/zlivanje/in.txt new file mode 100644 index 0000000..eaca3bf --- /dev/null +++ b/šola/aps1/dn/zlivanje/in.txt @@ -0,0 +1,26 @@ +25 3 2 +13 +18 +7 +8 +17 +3 +16 +9 +10 +11 +11 +0 +2 +19 +14 +5 +6 +15 +4 +5 +12 +3 +18 +1 +3 diff --git a/šola/aps1/dn/zlivanje/out.txt b/šola/aps1/dn/zlivanje/out.txt new file mode 100644 index 0000000..6def2f9 --- /dev/null +++ b/šola/aps1/dn/zlivanje/out.txt @@ -0,0 +1 @@ +0 2 3 3 4 5 5 6 7 8 9 10 11 11 12 13 14 15 16 17 18 18 19 1 3 diff --git a/šola/aps1/dn/zlivanje/resitev.cpp b/šola/aps1/dn/zlivanje/resitev.cpp new file mode 100644 index 0000000..8926019 --- /dev/null +++ b/šola/aps1/dn/zlivanje/resitev.cpp @@ -0,0 +1,39 @@ +#include <sys/param.h> +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +int compar_long (const void * a, const void * b) { + if (*(long *)a < *(long *)b) + return -1; + return *(long *)a > *(long *) b; +} +int main (void) { + long N, K, A; + scanf("%ld %ld %ld", &N, &K, &A); + long * d = (long *) malloc(N*sizeof *d); + long čet = 0; + long lastidx = 0; + long long četkončno = 1; + for (long i = 0; i < A && četkončno <= 2000000; i++) // pravzaprav četkončno := K**A, + četkončno *= K; // toda C nima int potence + // fprintf(stderr, "aaaaaaaa %ld\n", četkončno); + for (long i = 0; i < N; i++) { + scanf("%ld", d+i); + if (i && d[i-1] > d[i]) + if (++čet >= četkončno) { + qsort(d+lastidx, i-lastidx, sizeof d[0], compar_long); + čet = 0; + lastidx = i; + } + } + qsort(d+lastidx, N-lastidx, sizeof d[0], compar_long); + bool devica = true; + for (long i = 0; i < N; i++) { + if (devica) + devica = false; + else + printf(" "); + printf("%ld", d[i]); + } + printf("\n"); +} |