diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2024-06-03 18:54:14 +0200 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2024-06-03 18:54:14 +0200 |
commit | 3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb (patch) | |
tree | dc51ea1b9dc4429546c50dd54d232e81dd0538fd /šola/p2 | |
parent | ds2teor (diff) | |
parent | razne stvari iz b (diff) | |
download | r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar.gz r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar.bz2 r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar.lz r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar.xz r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar.zst r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.zip |
Diffstat (limited to 'šola/p2')
-rw-r--r-- | šola/p2/dn/DN07a_63230317.c | 25 | ||||
-rw-r--r-- | šola/p2/dn/DN07b_63230317.c | 24 |
2 files changed, 49 insertions, 0 deletions
diff --git a/šola/p2/dn/DN07a_63230317.c b/šola/p2/dn/DN07a_63230317.c new file mode 100644 index 0000000..3bc5323 --- /dev/null +++ b/šola/p2/dn/DN07a_63230317.c @@ -0,0 +1,25 @@ +#include <stdio.h> +#include <stdlib.h> +int globina (int * t) { + fprintf(stderr, "-> %d %d\n", t[0], t[1]); + if (!t[0] && !t[1]) + return 0; + int r = 0; + if (t[0]) + r = globina(t+2*t[0]); + if (t[1]) { + int g = globina(t+2*t[1]); + if (g > r) + r = g; + } + return r+1; + +} +int main (void) { + int n; + scanf("%d\n", &n); + int t[2*n]; + for (int i = 0; i < 2*n; i++) + scanf("%d", &t[i]); + printf("%d\n", globina(t)); +} diff --git a/šola/p2/dn/DN07b_63230317.c b/šola/p2/dn/DN07b_63230317.c new file mode 100644 index 0000000..72a1ee9 --- /dev/null +++ b/šola/p2/dn/DN07b_63230317.c @@ -0,0 +1,24 @@ +#include <stdio.h> +#include <stdbool.h> +#include <string.h> +int main (void) { + int n = 0; + scanf("%d\n", &n); + char nizi[n][43]; + int offseti[n]; + memset(offseti, 0, n*sizeof offseti[0]); + for (int i = 0; i < n; i++) + gets(nizi[i]); // izziv je v domačih nalogah pisat čim bolj nevarno a vseeno standardno C kodo + while (true) { + for (int i = 0; i < n; i++) + putchar(nizi[i][offseti[i]]); + putchar('\n'); + offseti[n-1]++; + for (int i = n-1; !nizi[i][offseti[i]]; i--) { + offseti[i] = 0; + offseti[i-1]++; + if (!i) + return 0; + } + } +} |