#3163
Se dă un șir de n
numere naturale și un număr natural val
. Determinați lungimea maximă a unei secvențe cu proprietatea că suma numerelor din aceasta este mai mică sau egală cu val
.
Problema | SecvMaxVal | Operații I/O |
![]() secvmaxval.in /secvmaxval.out
|
---|---|---|---|
Limita timp | 0.05 secunde | Limita memorie |
Total: 5 MB
/
Stivă 5 MB
|
Id soluție | #58307749 | Utilizator | |
Fișier | secvmaxval.cpp | Dimensiune | 725 B |
Data încărcării | 26 Mai 2025, 13:35 | Scor / rezultat | Eroare de compilare |
secvmaxval.cpp:3:1: error: 'ifstream' does not name a type ifstream fin("secvmaxval.in"); ^ secvmaxval.cpp:4:1: error: 'ofstream' does not name a type ofstream fout("secvmaxval.out"); ^ secvmaxval.cpp:6:1: error: 'int64_t' does not name a type int64_t s, sum, val; ^ secvmaxval.cpp: In function 'int main()': secvmaxval.cpp:9:5: error: 'ENTER' was not declared in this scope ENTER ^ secvmaxval.cpp:10:5: error: expected ';' before 'fin' fin >> n >> val; ^ secvmaxval.cpp:13:9: error: 'fin' was not declared in this scope fin >> v[i]; ^ secvmaxval.cpp:14:9: error: 's' was not declared in this scope s += v[i]; ^ secvmaxval.cpp:15:32: error: 'min' was not declared in this scope minim = min(minim, v[i]); ^ secvmaxval.cpp:17:9: error: 'val' was not declared in this scope if (val < minim) { ^ secvmaxval.cpp:18:9: error: 'fout' was not declared in this scope fout << 0; EXIT ^ secvmaxval.cpp:18:20: error: 'EXIT' was not declared in this scope fout << 0; EXIT ^ secvmaxval.cpp:19:5: error: expected ';' before '}' token } ^ secvmaxval.cpp:20:9: error: 'val' was not declared in this scope if (val >= s) { ^ secvmaxval.cpp:20:16: error: 's' was not declared in this scope if (val >= s) { ^ secvmaxval.cpp:21:9: error: 'fout' was not declared in this scope fout << n; EXIT ^ secvmaxval.cpp:21:20: error: 'EXIT' was not declared in this scope fout << n; EXIT ^ secvmaxval.cpp:22:5: error: expected ';' before '}' token } ^ secvmaxval.cpp:25:9: error: 'sum' was not declared in this scope sum = 0; ^ secvmaxval.cpp:29:23: error: 'val' was not declared in this scope if (sum > val) { ^ secvmaxval.cpp:30:39: error: 'max' was not declared in this scope lmax = max(lmax, j - i); ^ secvmaxval.cpp:35:5: error: 'fout' was not declared in this scope fout << lmax; ^ secvmaxval.cpp:36:5: error: 'EXIT' was not declared in this scope EXIT ^ secvmaxval.cpp:37:1: error: expected ';' before '}' token } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema SecvMaxVal 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ă.