#877
Cuburi2
Gigel are un set de n
cuburi. Fiecare cub este marcat cu un număr natural, de la 1
la n
și i se cunoaște lungimea laturii – număr natural. Cu o parte dintre aceste cuburi Gigel va construi o stivă, astfel:
Să se afișeze numerele de pe cuburile existente la final în stivă, de la bază spre vârf.
Problema | Cuburi2 | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #22461755 | Utilizator | |
Fișier | cuburi2.cpp | Dimensiune | 2.02 KB |
Data încărcării | 13 Aprilie 2020, 22:59 | Scor / rezultat | Eroare de compilare |
cuburi2.cpp: In function 'void checknull(void*)': cuburi2.cpp:7:10: error: 'exit' was not declared in this scope exit(69); ^ cuburi2.cpp: At global scope: cuburi2.cpp:14:2: error: conflicting declaration 'typedef struct node node' }node; ^ cuburi2.cpp:13:9: error: 'struct node' has a previous declaration as 'struct node' struct node* next; ^ cuburi2.cpp: In function 'void spush(stack*, int)': cuburi2.cpp:26:39: error: invalid application of 'sizeof' to incomplete type 'node' node* tmp = (node*)malloc(sizeof(node)); ^ cuburi2.cpp:26:40: error: 'malloc' was not declared in this scope node* tmp = (node*)malloc(sizeof(node)); ^ cuburi2.cpp:28:5: error: invalid use of incomplete type 'struct node' tmp->data = x; ^ cuburi2.cpp:13:9: error: forward declaration of 'struct node' struct node* next; ^ cuburi2.cpp:29:5: error: invalid use of incomplete type 'struct node' tmp->next = s->start; ^ cuburi2.cpp:13:9: error: forward declaration of 'struct node' struct node* next; ^ cuburi2.cpp: In function 'int spop(stack*)': cuburi2.cpp:35:23: error: invalid use of incomplete type 'struct node' int retval = s->start->data; ^ cuburi2.cpp:13:9: error: forward declaration of 'struct node' struct node* next; ^ cuburi2.cpp:37:21: error: invalid use of incomplete type 'struct node' s->start = s->start->next; ^ cuburi2.cpp:13:9: error: forward declaration of 'struct node' struct node* next; ^ cuburi2.cpp:38:10: error: 'free' was not declared in this scope free(tmp); ^ cuburi2.cpp: In function 'int main()': cuburi2.cpp:50:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &n); ^ cuburi2.cpp:59:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &cubeLenght); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Cuburi2 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ă.