#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 | #53279263 | Utilizator | |
Fișier | colier1.cpp | Dimensiune | 1.38 KB |
Data încărcării | 23 Octombrie 2024, 11:21 | Scor / rezultat | Eroare de compilare |
colier1.cpp:6:1: error: expected ',' or ';' before 'int' int n,m,s[12],str[13],c[13],nrmax,vmax[12]; ^ colier1.cpp: In function 'void afisare()': colier1.cpp:10:20: error: 'm' was not declared in this scope for(int i=1;i<=m;i++) ^ colier1.cpp:12:14: error: 'str' was not declared in this scope sum+=str[s[i]]; ^ colier1.cpp:12:18: error: 's' was not declared in this scope sum+=str[s[i]]; ^ colier1.cpp:15:12: error: 'nrmax' was not declared in this scope if(sum>nrmax) ^ colier1.cpp:18:24: error: 'm' was not declared in this scope for(int i=1;i<=m;i++) ^ colier1.cpp:20:13: error: 'vmax' was not declared in this scope vmax[i]=s[i]; ^ colier1.cpp:20:21: error: 's' was not declared in this scope vmax[i]=s[i]; ^ colier1.cpp: In function 'int continuare(int)': colier1.cpp:30:8: error: 'c' was not declared in this scope if(c[s[k]]==c[s[k-1]]) ^ colier1.cpp:30:10: error: 's' was not declared in this scope if(c[s[k]]==c[s[k-1]]) ^ colier1.cpp:34:12: error: 's' was not declared in this scope if(s[k]==s[i]) ^ colier1.cpp: In function 'void back(int)': colier1.cpp:41:11: error: 'm' was not declared in this scope if(k==m+1&&c[s[k-1]]!=c[s[1]]) ^ colier1.cpp:41:16: error: 'c' was not declared in this scope if(k==m+1&&c[s[k-1]]!=c[s[1]]) ^ colier1.cpp:41:18: error: 's' was not declared in this scope if(k==m+1&&c[s[k-1]]!=c[s[1]]) ^ colier1.cpp:47:29: error: 'n' was not declared in this scope for(int i=s[1]+1;i<=n;i++) ^ colier1.cpp: In function 'int main()': colier1.cpp:59:10: error: 'n' was not declared in this scope cin>>n>>m; ^ colier1.cpp:59:13: error: 'm' was not declared in this scope cin>>n>>m; ^ colier1.cpp:62:14: error: 'c' was not declared in this scope cin>>c[i]>>str[i]; ^ colier1.cpp:62:20: error: 'str' was not declared in this scope cin>>c[i]>>str[i]; ^ colier1.cpp:66:9: error: 's' was not declared in this scope s[1]=i; ^ colier1.cpp:72:15: error: 'vmax' was not declared in this scope cout<<vmax[i]<<" "; ^
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ă.