#134
SecvK
Se dă un șir cu n
numere naturale și un număr k
. Să se determine o secvență de elemente de lungime k
cu suma elementelor maximă.
Problema | SecvK | Operații I/O |
secvk.in /secvk.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54115814 | Utilizator | |
Fișier | secvk.cpp | Dimensiune | 638 B |
Data încărcării | 20 Noiembrie 2024, 09:08 | Scor / rezultat | Eroare de compilare |
secvk.cpp: In function 'int main()': secvk.cpp:7:12: error: 'n' was not declared in this scope cin >> n >> k; ^ secvk.cpp:7:17: error: 'k' was not declared in this scope cin >> n >> k; ^ secvk.cpp:8:10: error: 'i' was not declared in this scope for (i=1;i<=n;i++) ^ secvk.cpp:10:16: error: 'sir' was not declared in this scope cin >> sir[i]; ^ secvk.cpp:11:9: error: 'suma' was not declared in this scope suma[i]=suma[i-1]+sir[i]; ^ secvk.cpp:13:10: error: 'i' was not declared in this scope for (i=1;i<=n;i++) ^ secvk.cpp:15:14: error: 'j' was not declared in this scope for (j=i;j<=i-1+k;j++) ^ secvk.cpp:17:18: error: 'suma' was not declared in this scope if ((suma[j]-suma[i-1])>smax) ^ secvk.cpp:17:37: error: 'smax' was not declared in this scope if ((suma[j]-suma[i-1])>smax) ^ secvk.cpp:20:17: error: 'elem' was not declared in this scope elem=j-i+1; ^ secvk.cpp:21:22: error: 'x' was not declared in this scope for (x=i,y=0;x<=i-1+elem;x++) ^ secvk.cpp:21:26: error: 'y' was not declared in this scope for (x=i,y=0;x<=i-1+elem;x++) ^ secvk.cpp:24:21: error: 'v' was not declared in this scope v[y]=sir[x]; ^ secvk.cpp:24:26: error: 'sir' was not declared in this scope v[y]=sir[x]; ^ secvk.cpp:28:10: error: 'x' was not declared in this scope for (x=1;x<=i-1+elem;x++) ^ secvk.cpp:28:21: error: 'elem' was not declared in this scope for (x=1;x<=i-1+elem;x++) ^ secvk.cpp:30:17: error: 'v' was not declared in this scope cout << v[x] << " "; ^ secvk.cpp:33:1: error: expected '}' at end of input } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema SecvK 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ă.