#318
Se dau n numere naturale. Determinaţi o aranjare a acestor numere pe un cerc, astfel încât suma produselor de câte două numere vecine să fie maximă.
| Problema | Cerc | Operații I/O |
cerc.in/cerc.out
|
|---|---|---|---|
| Limita timp | 0.2 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64605390 | Utilizator | |
| Fișier | cerc.cpp | Dimensiune | 1.01 KB |
| Data încărcării | 18 Mai 2026, 11:24 | Scor/rezultat | Eroare de compilare |
cerc.cpp:12:1: error: expected ‘,’ or ‘;’ before ‘int’ 12 | int n, s[12], viz[12], v[12], sol[12], smax; | ^~~ cerc.cpp: In function ‘void citire()’: cerc.cpp:15:10: error: ‘n’ was not declared in this scope 15 | cin>>n; | ^ cerc.cpp:17:14: error: ‘v’ was not declared in this scope 17 | cin>>v[i]; | ^ cerc.cpp:20:12: error: ‘v’ was not declared in this scope 20 | if(v[i]>v[j]) | ^ cerc.cpp: In function ‘void backt(int, int)’: cerc.cpp:29:10: error: ‘n’ was not declared in this scope 29 | if(i>n) | ^ cerc.cpp:31:15: error: ‘v’ was not declared in this scope 31 | if(sp+v[s[n]]*v[s[i]]>smax) | ^ cerc.cpp:31:17: error: ‘s’ was not declared in this scope 31 | if(sp+v[s[n]]*v[s[i]]>smax) | ^ cerc.cpp:31:31: error: ‘smax’ was not declared in this scope 31 | if(sp+v[s[n]]*v[s[i]]>smax) | ^~~~ cerc.cpp:35:17: error: ‘sol’ was not declared in this scope 35 | sol[j]=s[j]; | ^~~ cerc.cpp:40:12: error: ‘viz’ was not declared in this scope 40 | if(viz[j]==0) | ^~~ cerc.cpp:42:9: error: ‘s’ was not declared in this scope 42 | s[i]=j; | ^ cerc.cpp:44:23: error: ‘v’ was not declared in this scope 44 | backt(i+1, sp+v[s[i-1]]*v[j]); | ^ cerc.cpp: In function ‘int main()’: cerc.cpp:52:5: error: ‘s’ was not declared in this scope 52 | s[1]=1; | ^ cerc.cpp:53:5: error: ‘viz’ was not declared in this scope 53 | viz[1]=1; | ^~~ cerc.cpp:55:21: error: ‘n’ was not declared in this scope 55 | for(int i=1 ;i<=n; i++) | ^ cerc.cpp:56:15: error: ‘v’ was not declared in this scope 56 | cout<<v[sol[i]]<<" "; | ^ cerc.cpp:56:17: error: ‘sol’ was not declared in this scope 56 | cout<<v[sol[i]]<<" "; | ^~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Cerc 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ă.