#1015
SumVec
Se consideră un șir cu n
elemente, numere naturale. Folosind metoda Divide et Impera, determinați suma elementelor acestui șir.
Problema | SumVec | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #11150799 | Utilizator | |
Fișier | sumvec.c | Dimensiune | 576 B |
Data încărcării | 19 Octombrie 2018, 12:56 | Scor / rezultat | 20 puncte |
sumvec.c: In function 'main': sumvec.c:25:3: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'long unsigned int *' [-Wformat=] scanf("%d", arr + i); ^ sumvec.c:28:2: warning: passing argument 1 of 'computeSum' from incompatible pointer type [enabled by default] printf("%d", computeSum(arr, 0, n - 1)); ^ sumvec.c:4:19: note: expected 'int *' but argument is of type 'long unsigned int *' unsigned long int computeSum(int* arr, unsigned int left, unsigned int right) { ^ sumvec.c:28:2: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long unsigned int' [-Wformat=] printf("%d", computeSum(arr, 0, n - 1)); ^ sumvec.c:22:7: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &n); ^ sumvec.c:25:8: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result] scanf("%d", arr + i); ^ sumvec.c:30:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
---|---|---|---|---|---|---|
1 | 0 secunde | OK. | 20 | 20 | Exemplu | |
2 | 0 secunde | Exited with error status 1 | 40 | 0 | ||
3 | 0 secunde | Exited with error status 1 | 40 | 0 | ||
Punctaj total | 20 |
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema SumVec 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ă.