#2996
paritar
Un șir format din 2•n
numere naturale se numește paritar dacă fiecare dintre primii săi n
termeni fie are aceeași paritate cu oricare dintre ultimii săi n
termeni, fie este strict mai mic decât oricare număr de paritate diferită aflat printre aceștia. Dându-se un șir de 2•n
numere naturale, să se afișeze mesajul DA
, în cazul în care șirul aflat în fișier este paritar, sau mesajul NU
, în caz contrar. Proiectați un algoritm eficient din punctul de vedere al timpului de executare și al memoriei utilizate.
Simulare bacalaureat 2019
Problema | paritar | Operații I/O |
paritar.in /paritar.out
|
---|---|---|---|
Limita timp | 0.3 secunde | Limita memorie |
Total: 2 MB
/
Stivă 1 MB
|
Id soluție | #53625692 | Utilizator | |
Fișier | paritar.cpp | Dimensiune | 840 B |
Data încărcării | 06 Noiembrie 2024, 19:06 | Scor / rezultat | Eroare de compilare |
paritar.cpp:7:1: error: stray '\342' in program int n, maxp = 0, maxi = 0, v[250001], ok = 1, nr = 0, x; ^ paritar.cpp:7:1: error: stray '\200' in program paritar.cpp:7:1: error: stray '\203' in program paritar.cpp:7:1: error: stray '\342' in program paritar.cpp:7:1: error: stray '\200' in program paritar.cpp:7:1: error: stray '\203' in program paritar.cpp:8:1: error: stray '\342' in program fin >> n; ^ paritar.cpp:8:1: error: stray '\200' in program paritar.cpp:8:1: error: stray '\203' in program paritar.cpp:8:1: error: stray '\342' in program paritar.cpp:8:1: error: stray '\200' in program paritar.cpp:8:1: error: stray '\203' in program paritar.cpp:9:1: error: stray '\342' in program for (int i = 1; i <= n; i++) ^ paritar.cpp:9:1: error: stray '\200' in program paritar.cpp:9:1: error: stray '\203' in program paritar.cpp:9:1: error: stray '\342' in program paritar.cpp:9:1: error: stray '\200' in program paritar.cpp:9:1: error: stray '\203' in program paritar.cpp:10:1: error: stray '\342' in program fin >> v[i]; ^ paritar.cpp:10:1: error: stray '\200' in program paritar.cpp:10:1: error: stray '\203' in program paritar.cpp:10:1: error: stray '\342' in program paritar.cpp:10:1: error: stray '\200' in program paritar.cpp:10:1: error: stray '\203' in program paritar.cpp:10:1: error: stray '\342' in program paritar.cpp:10:1: error: stray '\200' in program paritar.cpp:10:1: error: stray '\203' in program paritar.cpp:10:1: error: stray '\342' in program paritar.cpp:10:1: error: stray '\200' in program paritar.cpp:10:1: error: stray '\203' in program paritar.cpp:11:1: error: stray '\342' in program for (int i = 1; i <= n; i++) ^ paritar.cpp:11:1: error: stray '\200' in program paritar.cpp:11:1: error: stray '\203' in program paritar.cpp:11:1: error: stray '\342' in program paritar.cpp:11:1: error: stray '\200' in program paritar.cpp:11:1: error: stray '\203' in program paritar.cpp:12:1: error: stray '\342' in program { ^ paritar.cpp:12:1: error: stray '\200' in program paritar.cpp:12:1: error: stray '\203' in program paritar.cpp:12:1: error: stray '\342' in program paritar.cpp:12:1: error: stray '\200' in program paritar.cpp:12:1: error: stray '\203' in program paritar.cpp:13:1: error: stray '\342' in program fin >> x; ^ paritar.cpp:13:1: error: stray '\200' in program paritar.cpp:13:1: error: stray '\203' in program paritar.cpp:13:1: error: stray '\342' in program paritar.cpp:13:1: error: stray '\200' in program paritar.cpp:13:1: error: stray '\203' in program paritar.cpp:13:1: error: stray '\342' in program paritar.cpp:13:1: error: stray '\200' in program paritar.cpp:13:1: error: stray '\203' in program paritar.cpp:13:1: error: stray '\342' in program paritar.cpp:13:1: error: stray '\200' in program paritar.cpp:13:1: error: stray '\203' in program paritar.cpp:14:1: error: stray '\342' in program if (x % 2 == 1 && x > maxi) ^ paritar.cpp:14:1: error: stray '\200' in program paritar.cpp:14:1: error: stray '\203' in program paritar.cpp:14:1: error: stray '\342' in program paritar.cpp:14:1: error: stray '\200' in program paritar.cpp:14:1: error: stray '\203' in program paritar.cpp:14:1: error: stray '\342' in program paritar.cpp:14:1: error: stray '\200' in program paritar.cpp:14:1: error: stray '\203' in program paritar.cpp:14:1: error: stray '\342' in program paritar.cpp:14:1: error: stray '\200' in program paritar.cpp:14:1: error: stray '\203' in program paritar.cpp:15:1: error: stray '\342' in program maxi = x; ^ paritar.cpp:15:1: error: stray '\200' in program paritar.cpp:15:1: error: stray '\203' in program paritar.cpp:15:1: error: stray '\342' in program paritar.cpp:15:1: error: stray '\200' in program paritar.cpp:15:1: error: stray '\203' in program paritar.cpp:15:1: error: stray '\342' in program paritar.cpp:15:1: error: stray '\200' in program paritar.cpp:15:1: error: stray '\203' in program paritar.cpp:15:1: error: stray '\342' in program paritar.cpp:15:1: error: stray '\200' in program paritar.cpp:15:1: error: stray '\203' in program paritar.cpp:15:1: error: stray '\342' in program paritar.cpp:15:1: error: stray '\200' in program paritar.cpp:15:1: error: stray '\203' in program paritar.cpp:15:1: error: stray '\342' in program paritar.cpp:15:1: error: stray '\200' in program paritar.cpp:15:1: error: stray '\203' in program paritar.cpp:16:1: error: stray '\342' in program if (x % 2 == 0 && x > maxp) ^ paritar.cpp:16:1: error: stray '\200' in program paritar.cpp:16:1: error: stray '\203' in program paritar.cpp:16:1: error: stray '\342' in program paritar.cpp:16:1: error: stray '\200' in program paritar.cpp:16:1: error: stray '\203' in program paritar.cpp:16:1: error: stray '\342' in program paritar.cpp:16:1: error: stray '\200' in program paritar.cpp:16:1: error: stray '\203' in program paritar.cpp:16:1: error: stray '\342' in program paritar.cpp:16:1: error: stray '\200' in program paritar.cpp:16:1: error: stray '\203' in program paritar.cpp:17:1: error: stray '\342' in program maxp = x; ^ paritar.cpp:17:1: error: stray '\200' in program paritar.cpp:17:1: error: stray '\203' in program paritar.cpp:17:1: error: stray '\342' in program paritar.cpp:17:1: error: stray '\200' in program paritar.cpp:17:1: error: stray '\203' in program paritar.cpp:17:1: error: stray '\342' in program paritar.cpp:17:1: error: stray '\200' in program paritar.cpp:17:1: error: stray '\203' in program paritar.cpp:17:1: error: stray '\342' in program paritar.cpp:17:1: error: stray '\200' in program paritar.cpp:17:1: error: stray '\203' in program paritar.cpp:17:1: error: stray '\342' in program paritar.cpp:17:1: error: stray '\200' in program paritar.cpp:17:1: error: stray '\203' in program paritar.cpp:17:1: error: stray '\342' in program paritar.cpp:17:1: error: stray '\200' in program paritar.cpp:17:1: error: stray '\203' in program paritar.cpp:18:1: error: stray '\342' in program } ^ paritar.cpp:18:1: error: stray '\200' in program paritar.cpp:18:1: error: stray '\203' in program paritar.cpp:18:1: error: stray '\342' in program paritar.cpp:18:1: error: stray '\200' in program paritar.cpp:18:1: error: stray '\203' in program paritar.cpp:19:1: error: stray '\342' in program for (int i = 1; i <= n; i++) ^ paritar.cpp:19:1: error: stray '\200' in program paritar.cpp:19:1: error: stray '\203' in program paritar.cpp:19:1: error: stray '\342' in program paritar.cpp:19:1: error: stray '\200' in program paritar.cpp:19:1: error: stray '\203' in program paritar.cpp:20:1: error: stray '\342' in program { ^ paritar.cpp:20:1: error: stray '\200' in program paritar.cpp:20:1: error: stray '\203' in program paritar.cpp:20:1: error: stray '\342' in program paritar.cpp:20:1: error: stray '\200' in program paritar.cpp:20:1: error: stray '\203' in program paritar.cpp:21:1: error: stray '\342' in program if (v[i] % 2 == 0 && v[i] > maxi && maxi) { ^ paritar.cpp:21:1: error: stray '\200' in program paritar.cpp:21:1: error: stray '\203' in program paritar.cpp:21:1: error: stray '\342' in program paritar.cpp:21:1: error: stray '\200' in program paritar.cpp:21:1: error: stray '\203' in program paritar.cpp:21:1: error: stray '\342' in program paritar.cpp:21:1: error: stray '\200' in program paritar.cpp:21:1: error: stray '\203' in program paritar.cpp:21:1: error: stray '\342' in program paritar.cpp:21:1: error: stray '\200' in program paritar.cpp:21:1: error: stray '\203' in program paritar.cpp:22:1: error: stray '\342' in program fout << "NU"; ^ paritar.cpp:22:1: error: stray '\200' in program paritar.cpp:22:1: error: stray '\203' in program paritar.cpp:22:1: error: stray '\342' in program paritar.cpp:22:1: error: stray '\200' in program paritar.cpp:22:1: error: stray '\203' in program paritar.cpp:22:1: error: stray '\342' in program paritar.cpp:22:1: error: stray '\200' in program paritar.cpp:22:1: error: stray '\203' in program paritar.cpp:22:1: error: stray '\342' in program paritar.cpp:22:1: error: stray '\200' in program paritar.cpp:22:1: error: stray '\203' in program paritar.cpp:22:1: error: stray '\342' in program paritar.cpp:22:1: error: stray '\200' in program paritar.cpp:22:1: error: stray '\203' in program paritar.cpp:22:1: error: stray '\342' in program paritar.cpp:22:1: error: stray '\200' in program paritar.cpp:22:1: error: stray '\203' in program paritar.cpp:23:1: error: stray '\342' in program return 0; ^ paritar.cpp:23:1: error: stray '\200' in program paritar.cpp:23:1: error: stray '\203' in program paritar.cpp:23:1: error: stray '\342' in program paritar.cpp:23:1: error: stray '\200' in program paritar.cpp:23:1: error: stray '\203' in program paritar.cpp:23:1: error: stray '\342' in program paritar.cpp:23:1: error: stray '\200' in program paritar.cpp:23:1: error: stray '\203' in program paritar.cpp:23:1: error: stray '\342' in program paritar.cpp:23:1: error: stray '\200' in program paritar.cpp:23:1: error: stray '\203' in program paritar.cpp:23:1: error: stray '\342' in program paritar.cpp:23:1: error: stray '\200' in program paritar.cpp:23:1: error: stray '\203' in program paritar.cpp:23:1: error: stray '\342' in program paritar.cpp:23:1: error: stray '\200' in program paritar.cpp:23:1: error: stray '\203' in program paritar.cpp:24:1: error: stray '\342' in program } ^ paritar.cpp:24:1: error: stray '\200' in program paritar.cpp:24:1: error: stray '\203' in program paritar.cpp:24:1: error: stray '\342' in program paritar.cpp:24:1: error: stray '\200' in program paritar.cpp:24:1: error: stray '\203' in program paritar.cpp:24:1: error: stray '\342' in program paritar.cpp:24:1: error: stray '\200' in program paritar.cpp:24:1: error: stray '\203' in program paritar.cpp:24:1: error: stray '\342' in program paritar.cpp:24:1: error: stray '\200' in program paritar.cpp:24:1: error: stray '\203' in program paritar.cpp:25:1: error: stray '\342' in program if (v[i] % 2 == 1 && v[i] > maxp && maxp) { ^ paritar.cpp:25:1: error: stray '\200' in program paritar.cpp:25:1: error: stray '\203' in program paritar.cpp:25:1: error: stray '\342' in program paritar.cpp:25:1: error: stray '\200' in program paritar.cpp:25:1: error: stray '\203' in program paritar.cpp:25:1: error: stray '\342' in program paritar.cpp:25:1: error: stray '\200' in program paritar.cpp:25:1: error: stray '\203' in program paritar.cpp:25:1: error: stray '\342' in program paritar.cpp:25:1: error: stray '\200' in program paritar.cpp:25:1: error: stray '\203' in program paritar.cpp:26:1: error: stray '\342' in program fout << "NU"; ^ paritar.cpp:26:1: error: stray '\200' in program paritar.cpp:26:1: error: stray '\203' in program paritar.cpp:26:1: error: stray '\342' in program paritar.cpp:26:1: error: stray '\200' in program paritar.cpp:26:1: error: stray '\203' in program paritar.cpp:26:1: error: stray '\342' in program paritar.cpp:26:1: error: stray '\200' in program paritar.cpp:26:1: error: stray '\203' in program paritar.cpp:26:1: error: stray '\342' in program paritar.cpp:26:1: error: stray '\200' in program paritar.cpp:26:1: error: stray '\203' in program paritar.cpp:26:1: error: stray '\342' in program paritar.cpp:26:1: error: stray '\200' in program paritar.cpp:26:1: error: stray '\203' in program paritar.cpp:26:1: error: stray '\342' in program paritar.cpp:26:1: error: stray '\200' in program paritar.cpp:26:1: error: stray '\203' in program paritar.cpp:27:1: error: stray '\342' in program return 0; ^ paritar.cpp:27:1: error: stray '\200' in program paritar.cpp:27:1: error: stray '\203' in program paritar.cpp:27:1: error: stray '\342' in program paritar.cpp:27:1: error: stray '\200' in program paritar.cpp:27:1: error: stray '\203' in program paritar.cpp:27:1: error: stray '\342' in program paritar.cpp:27:1: error: stray '\200' in program paritar.cpp:27:1: error: stray '\203' in program paritar.cpp:27:1: error: stray '\342' in program paritar.cpp:27:1: error: stray '\200' in program paritar.cpp:27:1: error: stray '\203' in program paritar.cpp:27:1: error: stray '\342' in program paritar.cpp:27:1: error: stray '\200' in program paritar.cpp:27:1: error: stray '\203' in program paritar.cpp:27:1: error: stray '\342' in program paritar.cpp:27:1: error: stray '\200' in program paritar.cpp:27:1: error: stray '\203' in program paritar.cpp:28:1: error: stray '\342' in program } ^ paritar.cpp:28:1: error: stray '\200' in program paritar.cpp:28:1: error: stray '\203' in program paritar.cpp:28:1: error: stray '\342' in program paritar.cpp:28:1: error: stray '\200' in program paritar.cpp:28:1: error: stray '\203' in program paritar.cpp:28:1: error: stray '\342' in program paritar.cpp:28:1: error: stray '\200' in program paritar.cpp:28:1: error: stray '\203' in program paritar.cpp:28:1: error: stray '\342' in program paritar.cpp:28:1: error: stray '\200' in program paritar.cpp:28:1: error: stray '\203' in program paritar.cpp:29:1: error: stray '\342' in program } ^ paritar.cpp:29:1: error: stray '\200' in program paritar.cpp:29:1: error: stray '\203' in program paritar.cpp:29:1: error: stray '\342' in program paritar.cpp:29:1: error: stray '\200' in program paritar.cpp:29:1: error: stray '\203' in program paritar.cpp:30:1: error: stray '\342' in program fout << "DA"; ^ paritar.cpp:30:1: error: stray '\200' in program paritar.cpp:30:1: error: stray '\203' in program paritar.cpp:30:1: error: stray '\342' in program paritar.cpp:30:1: error: stray '\200' in program paritar.cpp:30:1: error: stray '\203' in program paritar.cpp:31:1: error: stray '\342' in program return 0; ^ paritar.cpp:31:1: error: stray '\200' in program paritar.cpp:31:1: error: stray '\203' in program paritar.cpp:31:1: error: stray '\342' in program paritar.cpp:31:1: error: stray '\200' in program paritar.cpp:31:1: error: stray '\203' in program paritar.cpp: In function 'int main()': paritar.cpp:7:45: warning: unused variable 'ok' [-Wunused-variable] int n, maxp = 0, maxi = 0, v[250001], ok = 1, nr = 0, x; ^ paritar.cpp:7:53: warning: unused variable 'nr' [-Wunused-variable] int n, maxp = 0, maxi = 0, v[250001], ok = 1, nr = 0, x; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema paritar 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ă.