#1877
kMax
Se dă un șir cu n
elemente, numere întregi, și un număr natural k ≤ n
. Calculați cea mai mare sumă care poate fi obținută schimbând semnul a exact k
elemente aflate pe poziții distincte din șirul dat.
Problema | kMax | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #12428136 | Utilizator | |
Fișier | kmax.cpp | Dimensiune | 818 B |
Data încărcării | 29 Noiembrie 2018, 16:43 | Scor / rezultat | Eroare de compilare |
kmax.cpp:1:9: error: #include expects "FILENAME" or <FILENAME> #include <iostream> ^ kmax.cpp:3:1: error: stray '\302' in program using namespace std; ^ kmax.cpp:3:1: error: stray '\240' in program kmax.cpp:3:1: error: stray '\302' in program kmax.cpp:3:1: error: stray '\240' in program kmax.cpp:5:1: error: stray '\302' in program int n,k,a[1001],i,minim,maxim,j,S; ^ kmax.cpp:5:1: error: stray '\240' in program kmax.cpp:7:1: error: stray '\302' in program int main() ^ kmax.cpp:7:1: error: stray '\240' in program kmax.cpp:10:1: error: stray '\302' in program cin >> n; ^ kmax.cpp:10:1: error: stray '\240' in program kmax.cpp:10:1: error: stray '\302' in program kmax.cpp:10:1: error: stray '\240' in program kmax.cpp:10:1: error: stray '\302' in program kmax.cpp:10:1: error: stray '\240' in program kmax.cpp:10:1: error: stray '\302' in program kmax.cpp:10:1: error: stray '\240' in program kmax.cpp:10:1: error: stray '\302' in program kmax.cpp:10:1: error: stray '\240' in program kmax.cpp:10:1: error: stray '\302' in program kmax.cpp:10:1: error: stray '\240' in program kmax.cpp:12:1: error: stray '\302' in program for(i=1;i<=n;i++) ^ kmax.cpp:12:1: error: stray '\240' in program kmax.cpp:12:1: error: stray '\302' in program kmax.cpp:12:1: error: stray '\240' in program kmax.cpp:12:1: error: stray '\302' in program kmax.cpp:12:1: error: stray '\240' in program kmax.cpp:12:1: error: stray '\302' in program kmax.cpp:12:1: error: stray '\240' in program kmax.cpp:13:1: error: stray '\302' in program cin >> a[i]; ^ kmax.cpp:13:1: error: stray '\240' in program kmax.cpp:13:1: error: stray '\302' in program kmax.cpp:13:1: error: stray '\240' in program kmax.cpp:13:1: error: stray '\302' in program kmax.cpp:13:1: error: stray '\240' in program kmax.cpp:13:1: error: stray '\302' in program kmax.cpp:13:1: error: stray '\240' in program kmax.cpp:13:1: error: stray '\302' in program kmax.cpp:13:1: error: stray '\240' in program kmax.cpp:13:1: error: stray '\302' in program kmax.cpp:13:1: error: stray '\240' in program kmax.cpp:13:1: error: stray '\302' in program kmax.cpp:13:1: error: stray '\240' in program kmax.cpp:15:1: error: stray '\302' in program cin >>k; ^ kmax.cpp:15:1: error: stray '\240' in program kmax.cpp:15:1: error: stray '\302' in program kmax.cpp:15:1: error: stray '\240' in program kmax.cpp:15:1: error: stray '\302' in program kmax.cpp:15:1: error: stray '\240' in program kmax.cpp:15:1: error: stray '\302' in program kmax.cpp:15:1: error: stray '\240' in program kmax.cpp:15:1: error: stray '\302' in program kmax.cpp:15:1: error: stray '\240' in program kmax.cpp:17:1: error: stray '\302' in program minim=a[1]; ^ kmax.cpp:17:1: error: stray '\240' in program kmax.cpp:17:1: error: stray '\302' in program kmax.cpp:17:1: error: stray '\240' in program kmax.cpp:17:1: error: stray '\302' in program kmax.cpp:17:1: error: stray '\240' in program kmax.cpp:17:1: error: stray '\302' in program kmax.cpp:17:1: error: stray '\240' in program kmax.cpp:18:1: error: stray '\302' in program maxim=a[1]; ^ kmax.cpp:18:1: error: stray '\240' in program kmax.cpp:18:1: error: stray '\302' in program kmax.cpp:18:1: error: stray '\240' in program kmax.cpp:18:1: error: stray '\302' in program kmax.cpp:18:1: error: stray '\240' in program kmax.cpp:18:1: error: stray '\302' in program kmax.cpp:18:1: error: stray '\240' in program kmax.cpp:20:1: error: stray '\302' in program for(i=1;i<=n;i++) ^ kmax.cpp:20:1: error: stray '\240' in program kmax.cpp:20:1: error: stray '\302' in program kmax.cpp:20:1: error: stray '\240' in program kmax.cpp:20:1: error: stray '\302' in program kmax.cpp:20:1: error: stray '\240' in program kmax.cpp:20:1: error: stray '\302' in program kmax.cpp:20:1: error: stray '\240' in program kmax.cpp:21:1: error: stray '\302' in program { ^ kmax.cpp:21:1: error: stray '\240' in program kmax.cpp:21:1: error: stray '\302' in program kmax.cpp:21:1: error: stray '\240' in program kmax.cpp:21:1: error: stray '\302' in program kmax.cpp:21:1: error: stray '\240' in program kmax.cpp:21:1: error: stray '\302' in program kmax.cpp:21:1: error: stray '\240' in program kmax.cpp:22:1: error: stray '\302' in program if(a[i]<minim) minim=a[i]; ^ kmax.cpp:22:1: error: stray '\240' in program kmax.cpp:22:1: error: stray '\302' in program kmax.cpp:22:1: error: stray '\240' in program kmax.cpp:22:1: error: stray '\302' in program kmax.cpp:22:1: error: stray '\240' in program kmax.cpp:22:1: error: stray '\302' in program kmax.cpp:22:1: error: stray '\240' in program kmax.cpp:22:1: error: stray '\302' in program kmax.cpp:22:1: error: stray '\240' in program kmax.cpp:22:1: error: stray '\302' in program kmax.cpp:22:1: error: stray '\240' in program kmax.cpp:22:1: error: stray '\302' in program kmax.cpp:22:1: error: stray '\240' in program kmax.cpp:22:1: error: stray '\302' in program kmax.cpp:22:1: error: stray '\240' in program kmax.cpp:22:1: error: stray '\302' in program kmax.cpp:22:1: error: stray '\240' in program kmax.cpp:23:1: error: stray '\302' in program if(a[i]>maxim) maxim=a[i]; ^ kmax.cpp:23:1: error: stray '\240' in program kmax.cpp:23:1: error: stray '\302' in program kmax.cpp:23:1: error: stray '\240' in program kmax.cpp:23:1: error: stray '\302' in program kmax.cpp:23:1: error: stray '\240' in program kmax.cpp:23:1: error: stray '\302' in program kmax.cpp:23:1: error: stray '\240' in program kmax.cpp:23:1: error: stray '\302' in program kmax.cpp:23:1: error: stray '\240' in program kmax.cpp:23:1: error: stray '\302' in program kmax.cpp:23:1: error: stray '\240' in program kmax.cpp:23:1: error: stray '\302' in program kmax.cpp:23:1: error: stray '\240' in program kmax.cpp:23:1: error: stray '\302' in program kmax.cpp:23:1: error: stray '\240' in program kmax.cpp:23:1: error: stray '\302' in program kmax.cpp:23:1: error: stray '\240' in program kmax.cpp:24:1: error: stray '\302' in program } ^ kmax.cpp:24:1: error: stray '\240' in program kmax.cpp:24:1: error: stray '\302' in program kmax.cpp:24:1: error: stray '\240' in program kmax.cpp:24:1: error: stray '\302' in program kmax.cpp:24:1: error: stray '\240' in program kmax.cpp:24:1: error: stray '\302' in program kmax.cpp:24:1: error: stray '\240' in program kmax.cpp:26:1: error: stray '\302' in program while(j<=k) ^ kmax.cpp:26:1: error: stray '\240' in program kmax.cpp:26:1: error: stray '\302' in program kmax.cpp:26:1: error: stray '\240' in program kmax.cpp:26:1: error: stray '\302' in program kmax.cpp:26:1: error: stray '\240' in program kmax.cpp:27:1: error: stray '\302' in program for(minim=minim;minim<=maxim;minim++) ^ kmax.cpp:27:1: error: stray '\240' in program kmax.cpp:27:1: error: stray '\302' in program kmax.cpp:27:1: error: stray '\240' in program kmax.cpp:27:1: error: stray '\302' in program kmax.cpp:27:1: error: stray '\240' in program kmax.cpp:27:1: error: stray '\302' in program kmax.cpp:27:1: error: stray '\240' in program kmax.cpp:28:1: error: stray '\302' in program for(i=1;i<=n;i++) ^ kmax.cpp:28:1: error: stray '\240' in program kmax.cpp:28:1: error: stray '\302' in program kmax.cpp:28:1: error: stray '\240' in program kmax.cpp:28:1: error: stray '\302' in program kmax.cpp:28:1: error: stray '\240' in program kmax.cpp:28:1: error: stray '\302' in program kmax.cpp:28:1: error: stray '\240' in program kmax.cpp:28:1: error: stray '\302' in program kmax.cpp:28:1: error: stray '\240' in program kmax.cpp:29:1: error: stray '\302' in program if(minim==a[i]) ^ kmax.cpp:29:1: error: stray '\240' in program kmax.cpp:29:1: error: stray '\302' in program kmax.cpp:29:1: error: stray '\240' in program kmax.cpp:29:1: error: stray '\302' in program kmax.cpp:29:1: error: stray '\240' in program kmax.cpp:29:1: error: stray '\302' in program kmax.cpp:29:1: error: stray '\240' in program kmax.cpp:29:1: error: stray '\302' in program kmax.cpp:29:1: error: stray '\240' in program kmax.cpp:29:1: error: stray '\302' in program kmax.cpp:29:1: error: stray '\240' in program kmax.cpp:30:1: error: stray '\302' in program { ^ kmax.cpp:30:1: error: stray '\240' in program kmax.cpp:30:1: error: stray '\302' in program kmax.cpp:30:1: error: stray '\240' in program kmax.cpp:30:1: error: stray '\302' in program kmax.cpp:30:1: error: stray '\240' in program kmax.cpp:30:1: error: stray '\302' in program kmax.cpp:30:1: error: stray '\240' in program kmax.cpp:30:1: error: stray '\302' in program kmax.cpp:30:1: error: stray '\240' in program kmax.cpp:30:1: error: stray '\302' in program kmax.cpp:30:1: error: stray '\240' in program kmax.cpp:30:1: error: stray '\302' in program kmax.cpp:30:1: error: stray '\240' in program kmax.cpp:30:1: error: stray '\302' in program kmax.cpp:30:1: error: stray '\240' in program kmax.cpp:30:1: error: stray '\302' in program kmax.cpp:30:1: error: stray '\240' in program kmax.cpp:30:1: error: stray '\302' in program kmax.cpp:30:1: error: stray '\240' in program kmax.cpp:30:1: error: stray '\302' in program kmax.cpp:30:1: error: stray '\240' in program kmax.cpp:30:1: error: stray '\302' in program kmax.cpp:30:1: error: stray '\240' in program kmax.cpp:30:1: error: stray '\302' in program kmax.cpp:30:1: error: stray '\240' in program kmax.cpp:31:1: error: stray '\302' in program j++; ^ kmax.cpp:31:1: error: stray '\240' in program kmax.cpp:31:1: error: stray '\302' in program kmax.cpp:31:1: error: stray '\240' in program kmax.cpp:31:1: error: stray '\302' in program kmax.cpp:31:1: error: stray '\240' in program kmax.cpp:31:1: error: stray '\302' in program kmax.cpp:31:1: error: stray '\240' in program kmax.cpp:31:1: error: stray '\302' in program kmax.cpp:31:1: error: stray '\240' in program kmax.cpp:31:1: error: stray '\302' in program kmax.cpp:31:1: error: stray '\240' in program kmax.cpp:31:1: error: stray '\302' in program kmax.cpp:31:1: error: stray '\240' in program kmax.cpp:31:1: error: stray '\302' in program kmax.cpp:31:1: error: stray '\240' in program kmax.cpp:31:1: error: stray '\302' in program kmax.cpp:31:1: error: stray '\240' in program kmax.cpp:31:1: error: stray '\302' in program kmax.cpp:31:1: error: stray '\240' in program kmax.cpp:31:1: error: stray '\302' in program kmax.cpp:31:1: error: stray '\240' in program kmax.cpp:31:1: error: stray '\302' in program kmax.cpp:31:1: error: stray '\240' in program kmax.cpp:31:1: error: stray '\302' in program kmax.cpp:31:1: error: stray '\240' in program kmax.cpp:31:1: error: stray '\302' in program kmax.cpp:31:1: error: stray '\240' in program kmax.cpp:31:1: error: stray '\302' in program kmax.cpp:31:1: error: stray '\240' in program kmax.cpp:31:1: error: stray '\302' in program kmax.cpp:31:1: error: stray '\240' in program kmax.cpp:31:1: error: stray '\302' in program kmax.cpp:31:1: error: stray '\240' in program kmax.cpp:31:1: error: stray '\302' in program kmax.cpp:31:1: error: stray '\240' in program kmax.cpp:32:1: error: stray '\302' in program if(j<=k) ^ kmax.cpp:32:1: error: stray '\240' in program kmax.cpp:32:1: error: stray '\302' in program kmax.cpp:32:1: error: stray '\240' in program kmax.cpp:32:1: error: stray '\302' in program kmax.cpp:32:1: error: stray '\240' in program kmax.cpp:32:1: error: stray '\302' in program kmax.cpp:32:1: error: stray '\240' in program kmax.cpp:32:1: error: stray '\302' in program kmax.cpp:32:1: error: stray '\240' in program kmax.cpp:32:1: error: stray '\302' in program kmax.cpp:32:1: error: stray '\240' in program kmax.cpp:32:1: error: stray '\302' in program kmax.cpp:32:1: error: stray '\240' in program kmax.cpp:32:1: error: stray '\302' in program kmax.cpp:32:1: error: stray '\240' in program kmax.cpp:32:1: error: stray '\302' in program kmax.cpp:32:1: error: stray '\240' in program kmax.cpp:32:1: error: stray '\302' in program kmax.cpp:32:1: error: stray '\240' in program kmax.cpp:32:1: error: stray '\302' in program kmax.cpp:32:1: error: stray '\240' in program kmax.cpp:32:1: error: stray '\302' in program kmax.cpp:32:1: error: stray '\240' in program kmax.cpp:32:1: error: stray '\302' in program kmax.cpp:32:1: error: stray '\240' in program kmax.cpp:32:1: error: stray '\302' in program kmax.cpp:32:1: error: stray '\240' in program kmax.cpp:32:1: error: stray '\302' in program kmax.cpp:32:1: error: stray '\240' in program kmax.cpp:32:1: error: stray '\302' in program kmax.cpp:32:1: error: stray '\240' in program kmax.cpp:32:1: error: stray '\302' in program kmax.cpp:32:1: error: stray '\240' in program kmax.cpp:32:1: error: stray '\302' in program kmax.cpp:32:1: error: stray '\240' in program kmax.cpp:33:1: error: stray '\302' in program a[i]=-a[i]; ^ kmax.cpp:33:1: error: stray '\240' in program kmax.cpp:33:1: error: stray '\302' in program kmax.cpp:33:1: error: stray '\240' in program kmax.cpp:33:1: error: stray '\302' in program kmax.cpp:33:1: error: stray '\240' in program kmax.cpp:33:1: error: stray '\302' in program kmax.cpp:33:1: error: stray '\240' in program kmax.cpp:33:1: error: stray '\302' in program kmax.cpp:33:1: error: stray '\240' in program kmax.cpp:33:1: error: stray '\302' in program kmax.cpp:33:1: error: stray '\240' in program kmax.cpp:33:1: error: stray '\302' in program kmax.cpp:33:1: error: stray '\240' in program kmax.cpp:33:1: error: stray '\302' in program kmax.cpp:33:1: error: stray '\240' in program kmax.cpp:33:1: error: stray '\302' in program kmax.cpp:33:1: error: stray '\240' in program kmax.cpp:33:1: error: stray '\302' in program kmax.cpp:33:1: error: stray '\240' in program kmax.cpp:33:1: error: stray '\302' in program kmax.cpp:33:1: error: stray '\240' in program kmax.cpp:33:1: error: stray '\302' in program kmax.cpp:33:1: error: stray '\240' in program kmax.cpp:33:1: error: stray '\302' in program kmax.cpp:33:1: error: stray '\240' in program kmax.cpp:33:1: error: stray '\302' in program kmax.cpp:33:1: error: stray '\240' in program kmax.cpp:33:1: error: stray '\302' in program kmax.cpp:33:1: error: stray '\240' in program kmax.cpp:33:1: error: stray '\302' in program kmax.cpp:33:1: error: stray '\240' in program kmax.cpp:33:1: error: stray '\302' in program kmax.cpp:33:1: error: stray '\240' in program kmax.cpp:33:1: error: stray '\302' in program kmax.cpp:33:1: error: stray '\240' in program kmax.cpp:33:1: error: stray '\302' in program kmax.cpp:33:1: error: stray '\240' in program kmax.cpp:35:1: error: stray '\302' in program } ^ kmax.cpp:35:1: error: stray '\240' in program kmax.cpp:35:1: error: stray '\302' in program kmax.cpp:35:1: error: stray '\240' in program kmax.cpp:35:1: error: stray '\302' in program kmax.cpp:35:1: error: stray '\240' in program kmax.cpp:35:1: error: stray '\302' in program kmax.cpp:35:1: error: stray '\240' in program kmax.cpp:35:1: error: stray '\302' in program kmax.cpp:35:1: error: stray '\240' in program kmax.cpp:35:1: error: stray '\302' in program kmax.cpp:35:1: error: stray '\240' in program kmax.cpp:35:1: error: stray '\302' in program kmax.cpp:35:1: error: stray '\240' in program kmax.cpp:35:1: error: stray '\302' in program kmax.cpp:35:1: error: stray '\240' in program kmax.cpp:35:1: error: stray '\302' in program kmax.cpp:35:1: error: stray '\240' in program kmax.cpp:35:1: error: stray '\302' in program kmax.cpp:35:1: error: stray '\240' in program kmax.cpp:35:1: error: stray '\302' in program kmax.cpp:35:1: error: stray '\240' in program kmax.cpp:35:1: error: stray '\302' in program kmax.cpp:35:1: error: stray '\240' in program kmax.cpp:35:1: error: stray '\302' in program kmax.cpp:35:1: error: stray '\240' in program kmax.cpp:39:1: error: stray '\302' in program for(i=1;i<=n;i++) ^ kmax.cpp:39:1: error: stray '\240' in program kmax.cpp:39:1: error: stray '\302' in program kmax.cpp:39:1: error: stray '\240' in program kmax.cpp:39:1: error: stray '\302' in program kmax.cpp:39:1: error: stray '\240' in program kmax.cpp:39:1: error: stray '\302' in program kmax.cpp:39:1: error: stray '\240' in program kmax.cpp:40:1: error: stray '\302' in program S+=a[i]; ^ kmax.cpp:40:1: error: stray '\240' in program kmax.cpp:40:1: error: stray '\302' in program kmax.cpp:40:1: error: stray '\240' in program kmax.cpp:40:1: error: stray '\302' in program kmax.cpp:40:1: error: stray '\240' in program kmax.cpp:40:1: error: stray '\302' in program kmax.cpp:40:1: error: stray '\240' in program kmax.cpp:40:1: error: stray '\302' in program kmax.cpp:40:1: error: stray '\240' in program kmax.cpp:42:1: error: stray '\302' in program cout << S; ^ kmax.cpp:42:1: error: stray '\240' in program kmax.cpp:42:1: error: stray '\302' in program kmax.cpp:42:1: error: stray '\240' in program kmax.cpp:42:1: error: stray '\302' in program kmax.cpp:42:1: error: stray '\240' in program kmax.cpp:42:1: error: stray '\302' in program kmax.cpp:42:1: error: stray '\240' in program kmax.cpp:42:1: error: stray '\302' in program kmax.cpp:42:1: error: stray '\240' in program kmax.cpp:42:1: error: stray '\302' in program kmax.cpp:42:1: error: stray '\240' in program kmax.cpp:44:1: error: stray '\302' in program return 0; ^ kmax.cpp:44:1: error: stray '\240' in program kmax.cpp:44:1: error: stray '\302' in program kmax.cpp:44:1: error: stray '\240' in program kmax.cpp:44:1: error: stray '\302' in program kmax.cpp:44:1: error: stray '\240' in program kmax.cpp:44:1: error: stray '\302' in program kmax.cpp:44:1: error: stray '\240' in program kmax.cpp:44:1: error: stray '\302' in program kmax.cpp:44:1: error: stray '\240' in program kmax.cpp: In function 'int main()': kmax.cpp:10:9: error: 'cin' was not declared in this scope cin >> n; ^ kmax.cpp:42:9: error: 'cout' was not declared in this scope cout << S; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema kMax 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ă.