#298
Se dă un şir format din n elemente, numere naturale. Calculaţi suma elementelor din secvenţa determinată de primul şi ultimul element prim.
| Problema | SumSec | Operații I/O |
sumsec.in/sumsec.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64283701 | Utilizator | |
| Fișier | sumsec.cpp | Dimensiune | 501 B |
| Data încărcării | 27 Aprilie 2026, 23:45 | Scor/rezultat | Eroare de compilare |
sumsec.cpp: In function ‘int prim(int)’: sumsec.cpp:8:6: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 8 | if(n%d==0) | ^~ sumsec.cpp:10:7: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 10 | return 1; | ^~~~~~ sumsec.cpp: In function ‘int main()’: sumsec.cpp:23:22: error: expected ‘)’ before ‘{’ token 23 | if(prim(v[i]==1) | ~ ^ | ) 24 | { p2=i; | ~ sumsec.cpp:23:6: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 23 | if(prim(v[i]==1) | ^~ sumsec.cpp:27:15: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 27 | for(p1;p1<=p2;p++) | ^~ sumsec.cpp:27:17: warning: statement has no effect [-Wunused-value] 27 | for(p1;p1<=p2;p++) | ~~^~~~ sumsec.cpp:27:22: error: ‘p’ was not declared in this scope 27 | for(p1;p1<=p2;p++) | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema SumSec 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ă.