From 5f2202e6fc843b7ad1811d69bdc95f23a6181380 Mon Sep 17 00:00:00 2001 From: Peter Petrek Date: Fri, 3 Dec 2021 00:01:02 +0100 Subject: [PATCH] maybe --- a4/program | Bin 6563 -> 7102 bytes a4/program.c | 98 ++++++++++++++++++++++++++++++++++----------------- 2 files changed, 65 insertions(+), 33 deletions(-) diff --git a/a4/program b/a4/program index c00ea409c7daf2163656496db6982ae33cac1a1a..9d4e350025082a8bd675a44cf7053f05747b37b6 100755 GIT binary patch literal 7102 zcmb7J4Q!M}8lJCRWYy9ZEGG()%~`Y>SPB*d8*?n}$Did#D4IJWpWE)XyU^}7yIY_J zJn$>x-qNHo+(i>k@$O<`#FLx^d!FG6RSMoES1a*Mj*GoqO}4fq^{BdchweSk%ue}Q zFn2e}+nHzHXWn^d=AHRwr$07pRvCsNbjlO?f@q-K<*q{315>na(`Sjmrdx&BlybQ#HPBJC{!!=wuS?qg!lrQD z!luB2rf{Tnk2fCmE>>;fnjG8e4O?Yf`pGsP2yK@@I5*UvX#B%T-=2$q{mu5J?ydK) zx@+3p%WJ8d2601ffxyM<5;+)}oGVO$m#LfgkzlRAt|=%itFbv6vEm7TEMZx~ zTDQyEoa0qB`Q!0mTs6O8V{}okyVwXDfpElXjRymwr8Q9>^2da%5-qWCB+(!m8iR>A zs$xyS2>Pv0w6z4SI;$yK4@6TrFPi<~h*({-c4d{d*!#eEsT>1D%9E?fzg$(uk0DF^ z%OKSYd0RM)(8(9S&(#%6oF^`@5z@fVUGAGOd7QH;2%J&isW3Ul96^;~4*gZ;+=$>! zMPRv@Bgov$5tLi(5qJ8}&>!e|{SJhQeKniS9_&s`Nv}ku{hoVU5Atg%yCe;Z*?A-Q z%i8Qb_8ekyXaG&K^XNf{x}iRa=}Cyg8tRsq9))HRpOBcIg*?Q^B&LU1l|w zH?$vk(dF&QzuAMMn`$?QiV;7dV?S}ZAAKxz=^)OIH$fQdoRCs;N_(6YUAM#B0?wM9 zxoLOam7XqG78vlCTa%yJBeQy4r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~Z9DWWh=F#~o+Hhrt_j#?!!S6!#oG zUi9|_ux^hh=O@5={0xlW8DQNW`4^%Au4h!E{dwX_;JuhXM(P~+cZ17;0P5}lUIG6Z zsdGwvA`Gm@JAl!OyW~0Bj}+l&fVtkm!aDo3@EkDrZQ?oD0iOrf_WZE-GnakS|m01mbqb)sgSz`kkM{t|F@CRN4$@wh3J9I^&jYMM5{-d}B2%pGU~#6;oXpOl@654fTALlzq_U8EO$>*8gxr?fSKKkaBV4gQhT7 zH{Q9jw$Z$E)v8Sm&1Q4$%EktolMjup>5TODzr2rbTedWWmrJv=)wH9T#MV&DHo@Dj zdZ=_BH&?9CZRozq=mTJm=6G-kS#i(g;ONIGdo!-)uAX4lSmQdRG!Gt3shm!5~o zK5|slORQVKd7^b!VZtz+&d9ZOn$d?aRJhVRRq{#pd=JDASa;y>TR!5>FlXYWS #include #include +#include + #define SIZE 100 bool jeKopa(int i, int inputNum[SIZE]); - +void vypisovac(int vypis[SIZE], int input[SIZE], int size); +int ownPow(int base, int power); +int input(char string[100], int numbers[100]); int main(){ char stringNum[100]; - int inputNum[100], i = 0; - while (1) - { - //scanf("%s",&stringNum); - fgets(stringNum,SIZE,stdin); - stringNum[strlen(stringNum)-1] = '\0'; - if (!isdigit(stringNum[0])) - { - break; - } - inputNum[i] = atoi(stringNum); - i++; - } - for (int j = (i-1)/2; j >= 0; j--) - { - - } + int inputNum[100] = {0}, i = 0; + fgets(stringNum,SIZE,stdin); + i = input(stringNum,inputNum) -1; + for (int j = 0; j < SIZE; j++){if(inputNum[j]<0-1){i++;}} int vypis[100]; if(jeKopa(i,inputNum)){ printf("Je to taka kopa:"); @@ -48,20 +39,7 @@ int main(){ } printf("\n"); - int count = 0; - for (int j = 0; j < i-1; j++) - { - if (j<=(i)/2) - { - for (int k = 0; k < count; k++) - { - printf(" "); - } - count++; - } - printf("%d\n",inputNum[vypis[j]]); - } - + vypisovac(vypis,inputNum,i); return 0; } @@ -73,7 +51,7 @@ bool jeKopa(int i, int inputNum[SIZE]){ { continue; } - if (inputNum[j]>inputNum[l] || inputNum[j]>inputNum[r]) + if ((inputNum[j]>inputNum[l]) || (inputNum[j]>inputNum[r])) { printf("Nieje kopa"); return 0; @@ -82,4 +60,58 @@ bool jeKopa(int i, int inputNum[SIZE]){ } return 1; +} +void vypisovac(int vypis[SIZE], int input[SIZE], int size){ + int counter = 0, count = ownPow(2,0), space = 0, i = 0; + for (i = 0; i < size; i++) + { + if (counter>=count && (i)<=(size/2)) + { + count = ownPow(2,i)/2; + counter = 0; + space++; + } + else if ((counter>=count && (i)>(size/2)) || vypis[i]0) + { + result = 1; + } + else{ + return 1; + } + + for (int i = 0; i