#166
Să se determine cea mai lungă secvență de elemente pare dintr-un vector.
Problema | SecvMax | Operații I/O |
![]() secvmax.in /secvmax.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #56208873 | Utilizator | |
Fișier | secvmax.cpp | Dimensiune | 1.14 KB |
Data încărcării | 10 Februarie 2025, 15:04 | Scor / rezultat | Eroare de compilare |
secvmax.cpp:5:15: warning: missing terminating " character [enabled by default] ofstream fout("secvamax.out); ^ secvmax.cpp:5:1: error: missing terminating " character ofstream fout("secvamax.out); ^ secvmax.cpp:7:7: error: 'i' has not been declared int n,i,x,lc,pc,sc,smax,lmax,pmax; ^ secvmax.cpp:7:9: error: 'x' has not been declared int n,i,x,lc,pc,sc,smax,lmax,pmax; ^ secvmax.cpp:7:11: error: 'lc' has not been declared int n,i,x,lc,pc,sc,smax,lmax,pmax; ^ secvmax.cpp:7:14: error: 'pc' has not been declared int n,i,x,lc,pc,sc,smax,lmax,pmax; ^ secvmax.cpp:7:17: error: 'sc' has not been declared int n,i,x,lc,pc,sc,smax,lmax,pmax; ^ secvmax.cpp:7:20: error: 'smax' has not been declared int n,i,x,lc,pc,sc,smax,lmax,pmax; ^ secvmax.cpp:7:25: error: 'lmax' has not been declared int n,i,x,lc,pc,sc,smax,lmax,pmax; ^ secvmax.cpp:7:30: error: 'pmax' has not been declared int n,i,x,lc,pc,sc,smax,lmax,pmax; ^ secvmax.cpp:7:34: error: expected ')' before ';' token int n,i,x,lc,pc,sc,smax,lmax,pmax; ^ secvmax.cpp: In function 'int main()': secvmax.cpp:15:10: error: 'n' was not declared in this scope fin>>n; ^ secvmax.cpp:16:9: error: 'i' was not declared in this scope for(i=1; i<=n; i++) ^ secvmax.cpp:18:14: error: 'x' was not declared in this scope fin>>x; ^ secvmax.cpp:21:16: error: 'lc' was not declared in this scope if(lc==0)///daca e primul 0 din secventa ^ secvmax.cpp:22:17: error: 'pc' was not declared in this scope pc=i;///retin pozitia primului 0 din secventa curenta ^ secvmax.cpp:23:13: error: 'lc' was not declared in this scope lc++;///maresc cu 1 lungimea secventei curente ^ secvmax.cpp:24:13: error: 'sc' was not declared in this scope sc+=x; ^ secvmax.cpp:29:16: error: 'lc' was not declared in this scope if(lc>lmax || lc==lmax && sc>smax) ^ secvmax.cpp:29:19: error: 'lmax' was not declared in this scope if(lc>lmax || lc==lmax && sc>smax) ^ secvmax.cpp:29:39: error: 'sc' was not declared in this scope if(lc>lmax || lc==lmax && sc>smax) ^ secvmax.cpp:29:42: error: 'smax' was not declared in this scope if(lc>lmax || lc==lmax && sc>smax) ^ secvmax.cpp:32:17: error: 'pmax' was not declared in this scope pmax=pc; ^ secvmax.cpp:32:22: error: 'pc' was not declared in this scope pmax=pc; ^ secvmax.cpp:35:13: error: 'lc' was not declared in this scope lc=0;///resetez lungimea secventei curenete pe 0 ^ secvmax.cpp:39:8: error: 'lc' was not declared in this scope if(lc>lmax || lc==lmax && sc>smax) ^ secvmax.cpp:39:11: error: 'lmax' was not declared in this scope if(lc>lmax || lc==lmax && sc>smax) ^ secvmax.cpp:39:31: error: 'sc' was not declared in this scope if(lc>lmax || lc==lmax && sc>smax) ^ secvmax.cpp:39:34: error: 'smax' was not declared in this scope if(lc>lmax || lc==lmax && sc>smax) ^ secvmax.cpp:42:17: error: 'pmax' was not declared in this scope pmax=pc; ^ secvmax.cpp:42:22: error: 'pc' was not declared in this scope pmax=pc; ^ secvmax.cpp:45:11: error: 'pmax' was not declared in this scope fout<<pmax<<" "<<pmax+lmax-1; ^ secvmax.cpp:45:27: error: 'lmax' was not declared in this scope fout<<pmax<<" "<<pmax+lmax-1; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema SecvMax 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ă.