#4960
Se dă un graf neorientat cu n noduri și două numere naturale p q. Să se determine nodurile din graf care au gradul între p și q.
| Problema | GradePQ | Operații I/O |
gradepq.in/gradepq.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #63928181 | Utilizator | |
| Fișier | gradepq.cpp | Dimensiune | 753 B |
| Data încărcării | 27 Martie 2026, 09:40 | Scor/rezultat | Eroare de compilare |
gradepq.cpp:4:5: error: expected ',' or ';' before 'ofstream' ofstream fout("gradepq.out") ^ gradepq.cpp: In function 'void citire()': gradepq.cpp:8:10: error: 'n' was not declared in this scope fin>>n>>p>>q; ^ gradepq.cpp:8:13: error: 'p' was not declared in this scope fin>>n>>p>>q; ^ gradepq.cpp:8:16: error: 'q' was not declared in this scope fin>>n>>p>>q; ^ gradepq.cpp:9:16: error: 'i' was not declared in this scope while(fin>>i>>j) ^ gradepq.cpp:9:19: error: 'j' was not declared in this scope while(fin>>i>>j) ^ gradepq.cpp:10:9: error: 'a' was not declared in this scope a[i][j]=a[j][i]=1; ^ gradepq.cpp: In function 'int grad(int)': gradepq.cpp:14:6: error: 'j' was not declared in this scope for(j=1; j<=n; j++) ^ gradepq.cpp:14:14: error: 'n' was not declared in this scope for(j=1; j<=n; j++) ^ gradepq.cpp:15:9: error: 'a' was not declared in this scope if(a[x][j]==1) ^ gradepq.cpp: In function 'int numarare(int (*)[101], int)': gradepq.cpp:20:2: error: 'nr' was not declared in this scope {nr=0; ^ gradepq.cpp:21:6: error: 'i' was not declared in this scope for(i=1; i<=n; i++) ^ gradepq.cpp:22:18: error: 'p' was not declared in this scope if(grad(i)>=p && grad(i)<=p) ^ gradepq.cpp: In function 'void afisare()': gradepq.cpp:26:14: error: 'a' was not declared in this scope {if(numarare(a,n)==0) ^ gradepq.cpp:26:16: error: 'n' was not declared in this scope {if(numarare(a,n)==0) ^ gradepq.cpp:27:5: error: 'fout' was not declared in this scope fout<<"nu exista"; ^ gradepq.cpp:30:6: error: 'fout' was not declared in this scope fout<<numarare(a,n)<<'\n'; ^ gradepq.cpp:31:10: error: 'i' was not declared in this scope for(i=1; i<=n; i++) ^ gradepq.cpp:32:22: error: 'p' was not declared in this scope if(grad(i)>=p && grad(i)<=q) ^ gradepq.cpp:32:36: error: 'q' was not declared in this scope if(grad(i)>=p && grad(i)<=q) ^ gradepq.cpp: In function 'int main()': gradepq.cpp:39:2: error: 'fout' was not declared in this scope fout.close(); ^ gradepq.cpp: In function 'int numarare(int (*)[101], int)': gradepq.cpp:24:16: warning: control reaches end of non-void function [-Wreturn-type] return nr;} ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema GradePQ 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ă.