#2256
colier1
Se consideră n
mărgele numerotate de la 1
la n
de culori și grad de strălucire diferite. Se generează toate posibilitățile de construire a unui colier de m
mărgele distincte, astfel încât mărgelele aflate pe poziții consecutive să fie de culori diferite. Un colier este cu atât mai prețios (valoros) cu cât suma gradelor de strălucire a mărgelelor este mai mare.
Să se determine cel mai prețios minim lexicografic colier format.
Problema | colier1 | Operații I/O |
colier.in /colier.out
|
---|---|---|---|
Limita timp | 0.7 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54403613 | Utilizator | |
Fișier | colier1.cpp | Dimensiune | 2.81 KB |
Data încărcării | 27 Noiembrie 2024, 17:53 | Scor / rezultat | Eroare de compilare |
colier1.cpp:5:1: error: stray '\304' in program struct Mărgea { ^ colier1.cpp:5:1: error: stray '\203' in program colier1.cpp:7:5: error: stray '\304' in program int grad_strălucire; ^ colier1.cpp:7:5: error: stray '\203' in program colier1.cpp:12:1: error: stray '\304' in program Mărgea mărgele[12]; // Maximum 12 mărgele, conform restricțiilor ^ colier1.cpp:12:1: error: stray '\203' in program colier1.cpp:12:1: error: stray '\304' in program colier1.cpp:12:1: error: stray '\203' in program colier1.cpp:15:1: error: stray '\304' in program int valoare_maximă = -1; ^ colier1.cpp:15:1: error: stray '\203' in program colier1.cpp:19:5: error: stray '\304' in program if (k > 0 && mărgele[colier_curent[k]].culoare == mărgele[colier_curent[k - 1]].culoare) ^ colier1.cpp:19:5: error: stray '\203' in program colier1.cpp:19:5: error: stray '\304' in program colier1.cpp:19:5: error: stray '\203' in program colier1.cpp:21:5: error: stray '\304' in program if (k == m - 1 && mărgele[colier_curent[k]].culoare == mărgele[colier_curent[0]].culoare) ^ colier1.cpp:21:5: error: stray '\203' in program colier1.cpp:21:5: error: stray '\304' in program colier1.cpp:21:5: error: stray '\203' in program colier1.cpp:30:9: error: stray '\304' in program sum += mărgele[colier_curent[i]].grad_strălucire; ^ colier1.cpp:30:9: error: stray '\203' in program colier1.cpp:30:9: error: stray '\304' in program colier1.cpp:30:9: error: stray '\203' in program colier1.cpp:36:5: error: stray '\304' in program int valoare_curentă = calcul_valoare(); ^ colier1.cpp:36:5: error: stray '\203' in program colier1.cpp:37:5: error: stray '\304' in program if (valoare_curentă > valoare_maximă) { ^ colier1.cpp:37:5: error: stray '\203' in program colier1.cpp:37:5: error: stray '\304' in program colier1.cpp:37:5: error: stray '\203' in program colier1.cpp:38:9: error: stray '\304' in program valoare_maximă = valoare_curentă; ^ colier1.cpp:38:9: error: stray '\203' in program colier1.cpp:38:9: error: stray '\304' in program colier1.cpp:38:9: error: stray '\203' in program colier1.cpp:41:5: error: stray '\304' in program } else if (valoare_curentă == valoare_maximă) { ^ colier1.cpp:41:5: error: stray '\203' in program colier1.cpp:41:5: error: stray '\304' in program colier1.cpp:41:5: error: stray '\203' in program colier1.cpp:76:9: error: stray '\304' in program fin >> mărgele[i].culoare >> mărgele[i].grad_strălucire; ^ colier1.cpp:76:9: error: stray '\203' in program colier1.cpp:76:9: error: stray '\304' in program colier1.cpp:76:9: error: stray '\203' in program colier1.cpp:76:9: error: stray '\304' in program colier1.cpp:76:9: error: stray '\203' in program colier1.cpp:77:9: error: stray '\304' in program mărgele[i].index = i + 1; ^ colier1.cpp:77:9: error: stray '\203' in program colier1.cpp:89:9: error: stray '\304' in program fout << mărgele[colier_maxim[i]].index << " "; ^ colier1.cpp:89:9: error: stray '\203' in program colier1.cpp:5:11: error: variable 'M rgea' has initializer but incomplete type struct Mărgea { ^ colier1.cpp:6:5: error: expected primary-expression before 'int' int culoare; ^ colier1.cpp:6:5: error: expected '}' before 'int' colier1.cpp:6:5: error: expected ',' or ';' before 'int' colier1.cpp:7:19: error: expected initializer before 'lucire' int grad_strălucire; ^ colier1.cpp:9:1: error: expected declaration before '}' token }; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema colier1 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ă.