#4154
Se dă un graf orientat cu n noduri. Să se determine câte componente tare conexe ale grafului sunt formate dintr-un singur nod.
| Problema | ComponenteTC | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64112699 | Utilizator | |
| Fișier | componentetc.cpp | Dimensiune | 467 B |
| Data încărcării | 17 Aprilie 2026, 16:01 | Scor/rezultat | Eroare de compilare |
componentetc.cpp:2:46: error: expected initializer before ‘/’ token 2 | int a[101][101],n,m,x,y,k,i,j,nr,viz[101],nrd/; | ^ componentetc.cpp: In function ‘int main()’: componentetc.cpp:4:2: error: ‘cin’ was not declared in this scope 4 | {cin>>n>>m; | ^~~ componentetc.cpp:1:1: note: ‘std::cin’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’? +++ |+#include <iostream> 1 | using namespace std; componentetc.cpp:19:17: warning: operation on ‘nr’ may be undefined [-Wsequence-point] 19 | if(viz[i]==0){nr=nr++; | ~~^~~~~ componentetc.cpp:19:17: warning: operation on ‘nr’ may be undefined [-Wsequence-point] componentetc.cpp:22:2: error: ‘nrd’ was not declared in this scope; did you mean ‘nr’? 22 | {nrd=0; | ^~~ | nr componentetc.cpp:25:11: error: ‘t’ was not declared in this scope 25 | if(nrd==1)t++; | ^ componentetc.cpp:26:1: error: ‘cout’ was not declared in this scope 26 | cout<<t; | ^~~~ componentetc.cpp:26:1: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’? componentetc.cpp:26:7: error: ‘t’ was not declared in this scope 26 | cout<<t; | ^ componentetc.cpp:28:2: error: expected ‘}’ at end of input 28 | } | ^ componentetc.cpp:19:14: note: to match this ‘{’ 19 | if(viz[i]==0){nr=nr++; | ^ componentetc.cpp:28:2: error: expected ‘}’ at end of input 28 | } | ^ componentetc.cpp:4:1: note: to match this ‘{’ 4 | {cin>>n>>m; | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema ComponenteTC 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ă.