#4459
Să se scrie o funcție C++ care va căuta, în caz că există, un nod care memorează valoarea val. Dacă există un asemenea nod, atunci va insera înainte de acest nod un nou nod ce va memora pe x, și de asemenea va insera după acest nod un nou nod ce va memora pe y.
| Problema | F_lsi_Add | Operații I/O |
f_lsi_add.in/f_lsi_add.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64294118 | Utilizator | |
| Fișier | f_lsi_add.cpp | Dimensiune | 444 B |
| Data încărcării | 28 Aprilie 2026, 12:31 | Scor/rezultat | Eroare de compilare |
f_lsi_add.cpp: In function ‘void LsiAdd(Nod*&, int, int, int)’: f_lsi_add.cpp:56:11: error: conversion from ‘Nod*’ to non-scalar type ‘Nod’ requested 56 | Nod q=new Nod; | ^~~~~~~ f_lsi_add.cpp:57:6: error: base operand of ‘->’ has non-pointer type ‘Nod’ 57 | q->info=y; | ^~ f_lsi_add.cpp:61:6: error: base operand of ‘->’ has non-pointer type ‘Nod’ 61 | q->leg=head->leg; | ^~ f_lsi_add.cpp:62:15: error: cannot convert ‘Nod’ to ‘Nod*’ in assignment 62 | head->leg=q; | ^ | | | Nod f_lsi_add.cpp:66:19: error: ‘null’ was not declared in this scope 66 | while(t->leg!=null) | ^~~~ f_lsi_add.cpp:73:10: error: base operand of ‘->’ has non-pointer type ‘Nod’ 73 | q->leg=t->leg; | ^~ f_lsi_add.cpp:74:16: error: cannot convert ‘Nod’ to ‘Nod*’ in assignment 74 | t->leg=q; | ^ | | | Nod f_lsi_add.cpp:79:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 79 | int main() | ^~ f_lsi_add.cpp:79:9: note: remove parentheses to default-initialize a variable 79 | int main() | ^~ | -- f_lsi_add.cpp:79:9: note: or replace parentheses with braces to value-initialize a variable f_lsi_add.cpp:80:1: error: a function-definition is not allowed here before ‘{’ token 80 | { | ^ f_lsi_add.cpp:88:2: error: expected ‘}’ at end of input 88 | } | ^ f_lsi_add.cpp:53:1: note: to match this ‘{’ 53 | { | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema F_lsi_Add face parte din a doua categorie. Pentru aceste probleme se folosește un program suport, furnizat de propunătorul problemei. 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ă.