From af2a5545638a8b88638c1561b319b05bbde35b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Sun, 3 Nov 2024 17:20:41 +0100 Subject: aps1dn2: zlivanje --- "\305\241ola/ana1/kolokvij2.lyx" | 121 +++++++++++++++-------------- "\305\241ola/aps1/dn/zlivanje/in.txt" | 26 +++++++ "\305\241ola/aps1/dn/zlivanje/out.txt" | 1 + "\305\241ola/aps1/dn/zlivanje/resitev.cpp" | 39 ++++++++++ 4 files changed, 130 insertions(+), 57 deletions(-) create mode 100644 "\305\241ola/aps1/dn/zlivanje/in.txt" create mode 100644 "\305\241ola/aps1/dn/zlivanje/out.txt" create mode 100644 "\305\241ola/aps1/dn/zlivanje/resitev.cpp" diff --git "a/\305\241ola/ana1/kolokvij2.lyx" "b/\305\241ola/ana1/kolokvij2.lyx" index a057288..4d94e99 100644 --- "a/\305\241ola/ana1/kolokvij2.lyx" +++ "b/\305\241ola/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/\305\241ola/aps1/dn/zlivanje/in.txt" "b/\305\241ola/aps1/dn/zlivanje/in.txt" new file mode 100644 index 0000000..eaca3bf --- /dev/null +++ "b/\305\241ola/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/\305\241ola/aps1/dn/zlivanje/out.txt" "b/\305\241ola/aps1/dn/zlivanje/out.txt" new file mode 100644 index 0000000..6def2f9 --- /dev/null +++ "b/\305\241ola/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/\305\241ola/aps1/dn/zlivanje/resitev.cpp" "b/\305\241ola/aps1/dn/zlivanje/resitev.cpp" new file mode 100644 index 0000000..8926019 --- /dev/null +++ "b/\305\241ola/aps1/dn/zlivanje/resitev.cpp" @@ -0,0 +1,39 @@ +#include +#include +#include +#include +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"); +} -- cgit v1.2.3