#802
SumImpK
C++
Scrieţi definiția completă a subprogramului C++ sub
care are 3
parametri: n
– prin care primește un număr natural, v
, prin care primeşte un tablou unidimensional cu n
elemente, numere naturale cu cel mult 4
cifre și k
, prin care primeşte un număr natural.
Subprogramul returnează suma primelor k
elemente cu valoare impară ale tabloului. Dacă nu există k
elemente impare în tablou, subprogramul returnează valoarea -1
.
Variante Bacalaureat 2013
Problema | SumImpK | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #51397219 | Utilizator | |
Fișier | sumimpk.cpp | Dimensiune | 305 B |
Data încărcării | 12 Iunie 2024, 16:48 | Scor / rezultat | Eroare de compilare |
sumimpk.cpp:6:1: error: stray '\302' in program int i, nr=0, s=0; ^ sumimpk.cpp:6:1: error: stray '\240' in program sumimpk.cpp:6:1: error: stray '\302' in program sumimpk.cpp:6:1: error: stray '\240' in program sumimpk.cpp:7:1: error: stray '\302' in program for(i=0; i<n; i++) ^ sumimpk.cpp:7:1: error: stray '\240' in program sumimpk.cpp:7:1: error: stray '\302' in program sumimpk.cpp:7:1: error: stray '\240' in program sumimpk.cpp:8:1: error: stray '\302' in program { ^ sumimpk.cpp:8:1: error: stray '\240' in program sumimpk.cpp:8:1: error: stray '\302' in program sumimpk.cpp:8:1: error: stray '\240' in program sumimpk.cpp:9:1: error: stray '\302' in program if(v[i]%2==1) ^ sumimpk.cpp:9:1: error: stray '\240' in program sumimpk.cpp:9:1: error: stray '\302' in program sumimpk.cpp:9:1: error: stray '\240' in program sumimpk.cpp:9:1: error: stray '\302' in program sumimpk.cpp:9:1: error: stray '\240' in program sumimpk.cpp:9:1: error: stray '\302' in program sumimpk.cpp:9:1: error: stray '\240' in program sumimpk.cpp:10:1: error: stray '\302' in program { ^ sumimpk.cpp:10:1: error: stray '\240' in program sumimpk.cpp:10:1: error: stray '\302' in program sumimpk.cpp:10:1: error: stray '\240' in program sumimpk.cpp:10:1: error: stray '\302' in program sumimpk.cpp:10:1: error: stray '\240' in program sumimpk.cpp:10:1: error: stray '\302' in program sumimpk.cpp:10:1: error: stray '\240' in program sumimpk.cpp:11:1: error: stray '\302' in program nr++; ^ sumimpk.cpp:11:1: error: stray '\240' in program sumimpk.cpp:11:1: error: stray '\302' in program sumimpk.cpp:11:1: error: stray '\240' in program sumimpk.cpp:11:1: error: stray '\302' in program sumimpk.cpp:11:1: error: stray '\240' in program sumimpk.cpp:11:1: error: stray '\302' in program sumimpk.cpp:11:1: error: stray '\240' in program sumimpk.cpp:11:1: error: stray '\302' in program sumimpk.cpp:11:1: error: stray '\240' in program sumimpk.cpp:11:1: error: stray '\302' in program sumimpk.cpp:11:1: error: stray '\240' in program sumimpk.cpp:12:1: error: stray '\302' in program if(nr<=k) ^ sumimpk.cpp:12:1: error: stray '\240' in program sumimpk.cpp:12:1: error: stray '\302' in program sumimpk.cpp:12:1: error: stray '\240' in program sumimpk.cpp:12:1: error: stray '\302' in program sumimpk.cpp:12:1: error: stray '\240' in program sumimpk.cpp:12:1: error: stray '\302' in program sumimpk.cpp:12:1: error: stray '\240' in program sumimpk.cpp:12:1: error: stray '\302' in program sumimpk.cpp:12:1: error: stray '\240' in program sumimpk.cpp:12:1: error: stray '\302' in program sumimpk.cpp:12:1: error: stray '\240' in program sumimpk.cpp:13:1: error: stray '\302' in program s=s+v[i]; ^ sumimpk.cpp:13:1: error: stray '\240' in program sumimpk.cpp:13:1: error: stray '\302' in program sumimpk.cpp:13:1: error: stray '\240' in program sumimpk.cpp:13:1: error: stray '\302' in program sumimpk.cpp:13:1: error: stray '\240' in program sumimpk.cpp:13:1: error: stray '\302' in program sumimpk.cpp:13:1: error: stray '\240' in program sumimpk.cpp:13:1: error: stray '\302' in program sumimpk.cpp:13:1: error: stray '\240' in program sumimpk.cpp:13:1: error: stray '\302' in program sumimpk.cpp:13:1: error: stray '\240' in program sumimpk.cpp:13:1: error: stray '\302' in program sumimpk.cpp:13:1: error: stray '\240' in program sumimpk.cpp:13:1: error: stray '\302' in program sumimpk.cpp:13:1: error: stray '\240' in program sumimpk.cpp:14:1: error: stray '\302' in program } ^ sumimpk.cpp:14:1: error: stray '\240' in program sumimpk.cpp:14:1: error: stray '\302' in program sumimpk.cpp:14:1: error: stray '\240' in program sumimpk.cpp:14:1: error: stray '\302' in program sumimpk.cpp:14:1: error: stray '\240' in program sumimpk.cpp:14:1: error: stray '\302' in program sumimpk.cpp:14:1: error: stray '\240' in program sumimpk.cpp:15:1: error: stray '\302' in program } ^ sumimpk.cpp:15:1: error: stray '\240' in program sumimpk.cpp:15:1: error: stray '\302' in program sumimpk.cpp:15:1: error: stray '\240' in program sumimpk.cpp:16:1: error: stray '\302' in program if(nr<k) ^ sumimpk.cpp:16:1: error: stray '\240' in program sumimpk.cpp:16:1: error: stray '\302' in program sumimpk.cpp:16:1: error: stray '\240' in program sumimpk.cpp:17:1: error: stray '\302' in program s=-1; ^ sumimpk.cpp:17:1: error: stray '\240' in program sumimpk.cpp:17:1: error: stray '\302' in program sumimpk.cpp:17:1: error: stray '\240' in program sumimpk.cpp:17:1: error: stray '\302' in program sumimpk.cpp:17:1: error: stray '\240' in program sumimpk.cpp:17:1: error: stray '\302' in program sumimpk.cpp:17:1: error: stray '\240' in program sumimpk.cpp:18:1: error: stray '\302' in program return s; ^ sumimpk.cpp:18:1: error: stray '\240' in program sumimpk.cpp:18:1: error: stray '\302' in program sumimpk.cpp:18:1: error: stray '\240' in program
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema SumImpK face parte din a doua categorie. Pentru aceste probleme se folosește un program suport, furnizat de propunătorul problemei. 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ă.