Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int pf[] = { 5, 8, -1, -1, 3, 7, -1, 10, -1, -1 };
- int fd[] = { -1, -1, 4, -1, 6, 2, -1, -1, -1, 9 };
- int fct(int radacina){
- int y = 1;
- int x = pf[radacina - 1];
- if (pf[radacina] == -1){
- y = 0;
- printf("%d", y);
- return y;
- }
- while (x != -1){
- x = fd[x-1];
- y++;
- }
- return y;
- }
- int main(){
- int j;
- int max = fct(0);
- for (j = 1; j < 10; j++){
- if (fct(j) > max){
- max = fct(i);
- }
- }
- printf("%d", max);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement