try
This commit is contained in:
parent
b3eb53e1b3
commit
6d360370d8
14
a4/program.c
14
a4/program.c
@ -20,7 +20,7 @@ int main(){
|
|||||||
int vypis[100];
|
int vypis[100];
|
||||||
if(jeKopa(i,inputNum)){
|
if(jeKopa(i,inputNum)){
|
||||||
printf("Je to taka kopa:");
|
printf("Je to taka kopa:");
|
||||||
//int temp = 0, count = 0;
|
int temp = 0, count = 0;
|
||||||
|
|
||||||
vypis[0] = 0;
|
vypis[0] = 0;
|
||||||
for (int j = 0; j+1 < i; j++)
|
for (int j = 0; j+1 < i; j++)
|
||||||
@ -30,16 +30,16 @@ int main(){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
vypis[j+1] = 2*j+1;
|
vypis[j+1] = 2*j+1;
|
||||||
vypis[i-(j+1)] = 2*j+2;
|
vypis[i-(j)] = 2*j+2;
|
||||||
}
|
}
|
||||||
if (i%2==0)
|
if (i%2!=0)
|
||||||
{
|
{
|
||||||
vypis[i/2] = inputNum[i-1];
|
vypis[(i/2)+1] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
vypisovac(vypis,inputNum,i);
|
vypisovac(vypis,inputNum,i+1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ bool jeKopa(int i, int inputNum[SIZE]){
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((inputNum[j]>inputNum[l]) || (inputNum[j]>inputNum[r]))
|
if (inputNum[j]>inputNum[l] || inputNum[j]>inputNum[r])
|
||||||
{
|
{
|
||||||
printf("Nieje kopa");
|
printf("Nieje kopa");
|
||||||
return 0;
|
return 0;
|
||||||
@ -65,7 +65,7 @@ void vypisovac(int vypis[SIZE], int input[SIZE], int size){
|
|||||||
int counter = 0, count = ownPow(2,0), space = 0, i = 0;
|
int counter = 0, count = ownPow(2,0), space = 0, i = 0;
|
||||||
for (i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
if (counter>=count && (i)<=(size/2))
|
if (counter>=count && i<=(size/2))
|
||||||
{
|
{
|
||||||
count = ownPow(2,i)/2;
|
count = ownPow(2,i)/2;
|
||||||
counter = 0;
|
counter = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user