#2
suma_n
Să se scrie un program care citeşte de la tastatură un şir de numere naturale şi determină suma lor.
Problema | suma_n | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #49517351 | Utilizator | |
Fișier | suma_n.cpp | Dimensiune | 5.71 KB |
Data încărcării | 05 Martie 2024, 15:24 | Scor / rezultat | 0 puncte |
suma_n.cpp: In function 'int main()': suma_n.cpp:16:16: warning: variable 'V' set but not used [-Wunused-but-set-variable] {int r,n,i,V[100],k,caz; ^ suma_n.cpp:42:35: warning: unused variable 'r5' [-Wunused-variable] {int n,m=0,s=1000,r1,r2,r3,r4,r5,caz,M[10][10]; ^ suma_n.cpp:124:10: warning: unused variable 'p' [-Wunused-variable] {int p=1,M[4][21]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,2,1,2,3,1,5,6,1,8,2,10,3,12,4,6,15,7,9,11,13,5,3,4,5,4,7,8,7,10,9,12,11,14,13,14,17,16,17,18,16,8,10,12,14,6,15,17,9,18,11,19,13,20,15,16,20,18,19,20,19},i,j; ^ suma_n.cpp:124:14: warning: unused variable 'M' [-Wunused-variable] {int p=1,M[4][21]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,2,1,2,3,1,5,6,1,8,2,10,3,12,4,6,15,7,9,11,13,5,3,4,5,4,7,8,7,10,9,12,11,14,13,14,17,16,17,18,16,8,10,12,14,6,15,17,9,18,11,19,13,20,15,16,20,18,19,20,19},i,j; ^ suma_n.cpp:124:229: warning: unused variable 'i' [-Wunused-variable] {int p=1,M[4][21]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,2,1,2,3,1,5,6,1,8,2,10,3,12,4,6,15,7,9,11,13,5,3,4,5,4,7,8,7,10,9,12,11,14,13,14,17,16,17,18,16,8,10,12,14,6,15,17,9,18,11,19,13,20,15,16,20,18,19,20,19},i,j; ^ suma_n.cpp:124:231: warning: unused variable 'j' [-Wunused-variable] {int p=1,M[4][21]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,2,1,2,3,1,5,6,1,8,2,10,3,12,4,6,15,7,9,11,13,5,3,4,5,4,7,8,7,10,9,12,11,14,13,14,17,16,17,18,16,8,10,12,14,6,15,17,9,18,11,19,13,20,15,16,20,18,19,20,19},i,j; ^ suma_n.cpp:79:56: warning: 'r4' may be used uninitialized in this function [-Wmaybe-uninitialized] else if((r1==r2 && r3==r4) || (r1==r3 && r2==r4) || (r1==r4 && r2==r3)) s+=M[caz][2]*n; ^
Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
---|---|---|---|---|---|---|
1 | 0 secunde | Raspuns gresit. | 10 | 0 | Exemplu | |
2 | 0 secunde | Raspuns gresit. | 90 | 0 | ||
Punctaj total | 0 |
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema suma_n 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ă.