#318
Cerc
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 | #54653710 | Utilizator | |
Fișier | cerc.cpp | Dimensiune | 996 B |
Data încărcării | 04 Decembrie 2024, 17:54 | Scor / rezultat | Eroare de compilare |
cerc.cpp:6:1: error: expected ',' or ';' before 'int' int n,k,x[100],a[100],s=0,b[100]; ^ cerc.cpp: In function 'int valid(int)': cerc.cpp:10:12: error: 'x' was not declared in this scope if(x[i]==x[k]) ^ cerc.cpp: In function 'void bec(int)': cerc.cpp:17:9: error: 'x' was not declared in this scope for(x[k]=1; x[k]<=n; x[k]++){ ^ cerc.cpp:17:23: error: 'n' was not declared in this scope for(x[k]=1; x[k]<=n; x[k]++){ ^ cerc.cpp:21:17: error: 's' was not declared in this scope s=s+a[x[k]]*a[x[k-1]]; ^ cerc.cpp:21:21: error: 'a' was not declared in this scope s=s+a[x[k]]*a[x[k-1]]; ^ cerc.cpp:24:17: error: 's' was not declared in this scope s=s+a[x[k]]*a[x[1]]; ^ cerc.cpp:24:21: error: 'a' was not declared in this scope s=s+a[x[k]]*a[x[1]]; ^ cerc.cpp:29:25: error: 'b' was not declared in this scope b[i]=a[x[i]]; ^ cerc.cpp:35:17: error: 's' was not declared in this scope s=s-a[x[k]]*a[x[k-1]]; ^ cerc.cpp:35:21: error: 'a' was not declared in this scope s=s-a[x[k]]*a[x[k-1]]; ^ cerc.cpp: In function 'int main()': cerc.cpp:41:8: error: 'n' was not declared in this scope f>>n; ^ cerc.cpp:43:12: error: 'a' was not declared in this scope f>>a[i]; ^ cerc.cpp:46:12: error: 'b' was not declared in this scope g<<b[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ă.