#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 | #53997611 | Utilizator | |
Fișier | cerc.cpp | Dimensiune | 1.11 KB |
Data încărcării | 17 Noiembrie 2024, 13:37 | Scor / rezultat | Eroare de compilare |
cerc.cpp:5:1: error: expected ',' or ';' before 'ofstream' ofstream out("cerc.out") ^ cerc.cpp: In function 'void afis()': cerc.cpp:12:26: error: 'n' was not declared in this scope for(int i = 1 ; i <= n ; i++) ^ cerc.cpp:13:17: error: 'st' was not declared in this scope cout << st[x[i]] << " "; ^ cerc.cpp:13:20: error: 'x' was not declared in this scope cout << st[x[i]] << " "; ^ cerc.cpp: In function 'int suma()': cerc.cpp:20:10: error: 'st' was not declared in this scope s += st[x[1]] * st[x[n]]; ^ cerc.cpp:20:13: error: 'x' was not declared in this scope s += st[x[1]] * st[x[n]]; ^ cerc.cpp:20:26: error: 'n' was not declared in this scope s += st[x[1]] * st[x[n]]; ^ cerc.cpp: In function 'void bk(int)': cerc.cpp:28:26: error: 'n' was not declared in this scope for (int i = 1; i <= n; i++) { ^ cerc.cpp:29:14: error: 'viz' was not declared in this scope if (!viz[i]) ^ cerc.cpp:31:13: error: 'x' was not declared in this scope x[k] = i; ^ cerc.cpp:36:27: error: 'maxi' was not declared in this scope if (sum > maxi) { ^ cerc.cpp:40:25: error: 'rez' was not declared in this scope rez[j] = x[j]; ^ cerc.cpp: In function 'int main()': cerc.cpp:50:11: error: 'n' was not declared in this scope in >> n; ^ cerc.cpp:53:15: error: 'st' was not declared in this scope in >> st[i]; ^ cerc.cpp:57:10: error: 'st' was not declared in this scope sort(st + 1, st + n + 1); ^ cerc.cpp:59:5: error: 'x' was not declared in this scope x[1] = 1; ^ cerc.cpp:62:13: error: 'afisare' was not declared in this scope afisare(); ^
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ă.