#3169
Se consideră n tipuri de bancnote, cu valorile v[1] v[2] ... v[n], ordonate strict crescător. Pentru fiecare tip de bancnote se știe numărul de bancnote disponibile c[1] c[2] ... c[n]. Se cere să se determine o modalitate de a plăti integral o sumă dată S cu bancnotele disponibile, astfel încât să se folosească cel puțin o bancnotă de fiecare tip.
| Problema | Plata2 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64812612 | Utilizator | |
| Fișier | plata2.cpp | Dimensiune | 803 B |
| Data încărcării | 02 Iunie 2026, 22:53 | Scor/rezultat | Eroare de compilare |
plata2.cpp:3:34: error: expected initializer before ‘a’ 3 | int n, S, v[10], c[10], i, x[10] a, b, c2, d, e, f, suma; | ^ plata2.cpp: In function ‘int main()’: plata2.cpp:9:10: error: ‘a’ was not declared in this scope 9 | for (a = 1; a <= c[1]; a++) | ^ plata2.cpp:10:10: error: ‘b’ was not declared in this scope 10 | for (b = 1; b <= c[2]; b++) | ^ plata2.cpp:11:10: error: ‘c2’ was not declared in this scope; did you mean ‘c’? 11 | for (c2 = 1; c2 <= c[3]; c2++) | ^~ | c plata2.cpp:12:10: error: ‘d’ was not declared in this scope 12 | for (d = 1; d <= c[4]; d++) | ^ plata2.cpp:13:10: error: ‘e’ was not declared in this scope 13 | for (e = 1; e <= c[5]; e++) | ^ plata2.cpp:14:10: error: ‘f’ was not declared in this scope 14 | for (f = 1; f <= c[6]; f++) | ^ plata2.cpp:16:18: error: ‘suma’ was not declared in this scope 16 | suma = a * v[1] + b * v[2] + c2 * v[3] + d * v[4] + e * v[5] + f * v[6]; | ^~~~ plata2.cpp:19:13: error: ‘x’ was not declared in this scope 19 | x[1] = a; | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Plata2 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ă.