#1854
Arbore Binar Complet
Se dau n
numere naturale, reprezentând în ordine valorile nodurilor dintr-un arbore binar complet și m
operații de tip 1
sau 2
, aplicate unui nod k
.
Operația de tip 1
determină valoarea nodului părinte a lui k
, iar operația de tip 2
determină suma valorilor fiilor nodului k
. Dacă k=1
sau dacă nodul k
nu are fii, rezultatul va fi 0
.
Afișați pentru fiecare operație rezultatul ei.
Problema | Arbore Binar Complet | Operații I/O |
complet.in /complet.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #37440308 | Utilizator | |
Fișier | arbore_binar_complet.c | Dimensiune | 752 B |
Data încărcării | 26 August 2022, 19:31 | Scor / rezultat | 0 puncte |
arbore_binar_complet.c: In function 'main': arbore_binar_complet.c:25:5: warning: passing argument 1 of 'fscanf' from incompatible pointer type [enabled by default] fscanf("%d", &n); ^ In file included from /usr/include/features.h:374:0, from /usr/include/stdio.h:27, from arbore_binar_complet.c:1: /usr/include/stdio.h:443:12: note: expected 'struct FILE * __restrict__' but argument is of type 'char *' extern int __REDIRECT (fscanf, (FILE *__restrict __stream, ^ arbore_binar_complet.c:25:5: warning: passing argument 2 of 'fscanf' from incompatible pointer type [enabled by default] fscanf("%d", &n); ^ In file included from /usr/include/features.h:374:0, from /usr/include/stdio.h:27, from arbore_binar_complet.c:1: /usr/include/stdio.h:443:12: note: expected 'const char * __restrict__' but argument is of type 'int *' extern int __REDIRECT (fscanf, (FILE *__restrict __stream, ^ arbore_binar_complet.c:25:5: warning: format not a string literal and no format arguments [-Wformat-security] fscanf("%d", &n); ^ arbore_binar_complet.c:27:9: warning: passing argument 1 of 'fscanf' from incompatible pointer type [enabled by default] fscanf("%d", v[i]); ^ In file included from /usr/include/features.h:374:0, from /usr/include/stdio.h:27, from arbore_binar_complet.c:1: /usr/include/stdio.h:443:12: note: expected 'struct FILE * __restrict__' but argument is of type 'char *' extern int __REDIRECT (fscanf, (FILE *__restrict __stream, ^ arbore_binar_complet.c:27:9: warning: passing argument 2 of 'fscanf' makes pointer from integer without a cast [enabled by default] fscanf("%d", v[i]); ^ In file included from /usr/include/features.h:374:0, from /usr/include/stdio.h:27, from arbore_binar_complet.c:1: /usr/include/stdio.h:443:12: note: expected 'const char * __restrict__' but argument is of type 'int' extern int __REDIRECT (fscanf, (FILE *__restrict __stream, ^ arbore_binar_complet.c:27:9: warning: format not a string literal and no format arguments [-Wformat-security] fscanf("%d", v[i]); ^ arbore_binar_complet.c:28:5: warning: passing argument 1 of 'fscanf' from incompatible pointer type [enabled by default] fscanf("%d", &m); ^ In file included from /usr/include/features.h:374:0, from /usr/include/stdio.h:27, from arbore_binar_complet.c:1: /usr/include/stdio.h:443:12: note: expected 'struct FILE * __restrict__' but argument is of type 'char *' extern int __REDIRECT (fscanf, (FILE *__restrict __stream, ^ arbore_binar_complet.c:28:5: warning: passing argument 2 of 'fscanf' from incompatible pointer type [enabled by default] fscanf("%d", &m); ^ In file included from /usr/include/features.h:374:0, from /usr/include/stdio.h:27, from arbore_binar_complet.c:1: /usr/include/stdio.h:443:12: note: expected 'const char * __restrict__' but argument is of type 'int *' extern int __REDIRECT (fscanf, (FILE *__restrict __stream, ^ arbore_binar_complet.c:28:5: warning: format not a string literal and no format arguments [-Wformat-security] fscanf("%d", &m); ^ arbore_binar_complet.c:31:9: warning: passing argument 1 of 'fscanf' from incompatible pointer type [enabled by default] fscanf("%d%d", &tkn, &k); ^ In file included from /usr/include/features.h:374:0, from /usr/include/stdio.h:27, from arbore_binar_complet.c:1: /usr/include/stdio.h:443:12: note: expected 'struct FILE * __restrict__' but argument is of type 'char *' extern int __REDIRECT (fscanf, (FILE *__restrict __stream, ^ arbore_binar_complet.c:31:9: warning: passing argument 2 of 'fscanf' from incompatible pointer type [enabled by default] fscanf("%d%d", &tkn, &k); ^ In file included from /usr/include/features.h:374:0, from /usr/include/stdio.h:27, from arbore_binar_complet.c:1: /usr/include/stdio.h:443:12: note: expected 'const char * __restrict__' but argument is of type 'int *' extern int __REDIRECT (fscanf, (FILE *__restrict __stream, ^ arbore_binar_complet.c:32:17: warning: assignment makes integer from pointer without a cast [enabled by default] if (tkn = "1") ^ arbore_binar_complet.c:32:9: warning: suggest parentheses around assignment used as truth value [-Wparentheses] if (tkn = "1") ^ arbore_binar_complet.c:33:13: warning: passing argument 1 of 'fprintf' from incompatible pointer type [enabled by default] fprintf("%d\n", parent_value(k)); ^ In file included from /usr/include/stdio.h:937:0, from arbore_binar_complet.c:1: /usr/include/i386-linux-gnu/bits/stdio2.h:95:1: note: expected 'struct FILE * __restrict__' but argument is of type 'char *' fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) ^ arbore_binar_complet.c:33:13: warning: passing argument 2 of 'fprintf' makes pointer from integer without a cast [enabled by default] fprintf("%d\n", parent_value(k)); ^ In file included from /usr/include/stdio.h:937:0, from arbore_binar_complet.c:1: /usr/include/i386-linux-gnu/bits/stdio2.h:95:1: note: expected 'const char * __restrict__' but argument is of type 'int' fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) ^ arbore_binar_complet.c:33:13: warning: format not a string literal and no format arguments [-Wformat-security] fprintf("%d\n", parent_value(k)); ^ arbore_binar_complet.c:34:17: warning: assignment makes integer from pointer without a cast [enabled by default] if (tkn = "2") ^ arbore_binar_complet.c:34:9: warning: suggest parentheses around assignment used as truth value [-Wparentheses] if (tkn = "2") ^ arbore_binar_complet.c:35:13: warning: passing argument 1 of 'fprintf' from incompatible pointer type [enabled by default] fprintf("%d\n", descendent_sum(k)); ^ In file included from /usr/include/stdio.h:937:0, from arbore_binar_complet.c:1: /usr/include/i386-linux-gnu/bits/stdio2.h:95:1: note: expected 'struct FILE * __restrict__' but argument is of type 'char *' fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) ^ arbore_binar_complet.c:35:13: warning: passing argument 2 of 'fprintf' makes pointer from integer without a cast [enabled by default] fprintf("%d\n", descendent_sum(k)); ^ In file included from /usr/include/stdio.h:937:0, from arbore_binar_complet.c:1: /usr/include/i386-linux-gnu/bits/stdio2.h:95:1: note: expected 'const char * __restrict__' but argument is of type 'int' fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) ^ arbore_binar_complet.c:35:13: warning: format not a string literal and no format arguments [-Wformat-security] fprintf("%d\n", descendent_sum(k)); ^ arbore_binar_complet.c:25:11: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result] fscanf("%d", &n); ^ arbore_binar_complet.c:27:15: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result] fscanf("%d", v[i]); ^ arbore_binar_complet.c:28:11: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result] fscanf("%d", &m); ^ arbore_binar_complet.c:31:15: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result] fscanf("%d%d", &tkn, &k); ^
Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
---|---|---|---|---|---|---|
1 | 0 secunde | Caught fatal signal 11 | 20 | 0 | Exemplu | |
2 | 0 secunde | Caught fatal signal 11 | 20 | 0 | ||
3 | 0 secunde | Caught fatal signal 11 | 20 | 0 | ||
4 | 0 secunde | Caught fatal signal 11 | 20 | 0 | ||
5 | 0 secunde | Caught fatal signal 11 | 20 | 0 | ||
Punctaj total | 0 |
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Arbore Binar Complet face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.