From bd813885aeca260c0ccb0f2f33429852194c65f0 Mon Sep 17 00:00:00 2001 From: Yaroslav Orlianskyi Date: Thu, 17 Mar 2022 19:18:11 +0100 Subject: [PATCH] DSA --- du3/program | Bin 6706 -> 5440 bytes du3/program.c | 34 ++++++++++++++++------------------ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/du3/program b/du3/program index 2f8369d363f11c6bb657ed3ea86fb9ec4db90b55..be352b71bbd9e7884ffdd99e1b1016105793f375 100755 GIT binary patch delta 2661 zcmZ8jZERCj7(TbX?e2xHYghKg2EDLu@(qImjSTEy!LLO(`37aJz-*K8Ayk0`QfD`? z8BInGMvTV5A7bJka5EthInrs0Qkf3P5`aJipb9$O{-}Aihc|Xp3 z-g8br5BAUMDX;8FsajA7aZ1MrEhr43i5bE#s*W#eSsp47g55!xM+gPP>IgADe*~!T?J+HH zJ6n3})06cOYHqjS2F!-B_{>I&&lVq#il<+a6@kLtS+B zCmya#|C+i}epwArm>V3(_GA*Z;ylsZi2TDoGieI0QP5XQt#_7_Bi{0vs@m`&`1sC2 zo-*(t+tzbBjM{kCB5=8A;#+$%ZuuzT=Ju8NA#Wm{MmfG(e{_?)JcfOs|S04%f+hj!n%H#yheTDZQj^ z$?^aysN=TK^9HxpWm{S3c=4z`rP_T;w&8Na zw=OdsA&A@2FG;;%X~m})J%Uf3!+eXNUc+)zL1je%sj2{*_fsV(Bejlurl73iLWipH z5@~uD=Mr=XnA@^hepOJ`6hax&Dr1|3?nN&{AHr;ouY>YB(a?RP6oKsS10Rdt&1KvJ zJp+t;Y|&KnCIr)Lt8v+`M{h%a8~upfsjceOT~0+#*JjDi!ehz;>2>>c26+Lt3?QFu za=UbfIRwrg8HJp|HzCf=@~YP-KZcwR&w%5W=OAY|eL#l1;r2Ti^mX~fU9EE&L*UPl zGmBnUBJyC7U*`+ZgWWzMPXjS|0pw+pyjbXyLq#q<1WpK?a(N$e^DYOPW6I}vT>2r% z4}o(*HhBCxlgDIu6^3!6kR+ZMJSQR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mx)8^52&8fKz|{lSB|YlFoDlnMkjC-;y%)GicGfAxu^aVLamGoftTN2fAq72^ci)ImCMoxZ@fGu5rJG%xxFlmuDQ_ z<+Tr{8Toa{6(Hhx_SyC&xIe(pc8TL9V*8ii{scd|BysZJ0C3aL!DL|{_ zyI?HtAN7j`IG(Axf#dm17h*{N0O@!GzzqP$c68CPufRY%$H5!Z5EShrR?DA3X1sbD zQHbL?RTuh5C3ukQavZpTR=~CI+9KQ(aNGiP(c;ZTxa+V{AJialjjJodJp2*;T03%M?D0#`g<`gnF_?sS=l#b8rGMJDN$Dy8*IlKn7P!7DUA<+lqe|xrtkz4V^9xq% zqSDpZtIy(Y=gZ@7>=eN?;O2v7sbaivlcLuk(j%NAqM)`Sj zQFj`pS4*AqOzFHysrjUI-lS%WTX1)sE$%rpnD6f^vrb5EaZ{0AxMI>DDDvMt=iBv& zzvsC}>G2u3nX!lCPJUfj8AH&g3-o5_`o2j2L(t_P6>tML!(MQmKLacMVd%VLg5f*& ziywgVE=k?M$zhCwQ`n!v@0j{Y___{he3h7jUfADr&~Bq5#jY=?UoauM^}- z^#1^K{e4zp2N^A>Uy1t13hD9`^srE;^Juoee;8E?G?Rz= zInddwlxenaZeG8}T(hAK-Bx4J@|#=;XxL3_L(02k<3kwZ2iAj CW~opB diff --git a/du3/program.c b/du3/program.c index b6f470e..6fafbe8 100644 --- a/du3/program.c +++ b/du3/program.c @@ -1,24 +1,22 @@ #include +#include +#include +#define LINE_SIZE 999 int main(){ - int result = 0; - int value = 0; - int vxod[999]; - int a = 0; - //int b = 999; - for(int i = 0; i < 999; i++) - vxod[i] = 0; - for(int i = 0; i < 999; i++){ - scanf("%d",&value); - vxod[i] = value; + char line[LINE_SIZE] = "1 2 3 4"; + int len = strlen(line); + char* endptr = NULL; + char* start = line; + int num = 0; + while (start < (line + len)){ + num = strtol(start,&endptr,10); + if (num){ + printf("Nacital som %d\n",num); + start = endptr + 1; + } + else + break; } - for(int i = 0; i < 999; i++){ - if(vxod[i] > 0) - a++; - } - for(int i = 1; i < a; i++){ - result = vxod[0] * result + vxod[i]; - } - printf("Vysledok je: %d.00\n", result); return 0; }