35 lines
544 B
C
35 lines
544 B
C
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
int is_heap(int* arr, int size ){
|
|
for(int i = 0; i < size; i++){
|
|
int l = i * 2 + 1;
|
|
int r = i * 2 + 2;
|
|
}
|
|
|
|
if (l < size && arr[i] < arr[l]){
|
|
return 0;
|
|
}
|
|
|
|
if (r < size && arr[i] < arr[r]){
|
|
return 0;
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
int main() {
|
|
int arr[] = 100;
|
|
int size = 0;
|
|
|
|
while (scanf("%d", &num) != EOF){
|
|
arr[size++] = num;
|
|
}
|
|
|
|
if (!is_heap(arr, size)){
|
|
printf("Nie je kopa.");
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|