#3709
tri
Se citește un număr n
și apoi n
numere naturale. Numim secvență un grup de elemente aflate pe poziții consecutive în șirul citit. Numim tri-secvență o secvență care începe cu un element impar, se termină cu un element impar și care mai conține în interior exact un element impar. Astfel, fiecare tri-secvență include două secvențe maximale formate doar din elemente pare (eventual, fiecare dintre cele două poate fi vidă). Dezechilibrul unei tri-secvențe se calculează astfel: determinăm suma elementelor din secvența din stânga formată doar din elemente pare, suma elementelor din secvența din dreapta formată doar din elemente pare și apoi diferența în modul a celor două valori (adică scădem din cea mare pe cea mică). Dacă vreuna dintre cele două secvențe de elemente pare este vidă, aceasta se consideră de sumă 0
. Această diferență reprezintă dezechilibrul tri-secvenței. Să se determine o tri-secvența de dezechilibru minim. Dacă sunt mai multe astfel de tri-secvențe, să se determine cea care începe la o poziție cât mai mare.
Concursul Național Info Pro, Etapa IV
Problema | tri | Operații I/O |
tri.in /tri.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 128 MB
/
Stivă 8 MB
|
Id soluție | #28424049 | Utilizator | |
Fișier | tri.cpp | Dimensiune | 2.72 KB |
Data încărcării | 05 Martie 2021, 10:24 | Scor / rezultat | Eroare de compilare |
tri.cpp:16:29: error: stray '@' in program string connString = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=D:\12A\p66_sub_3_atestat\p66_sub_3_atestat\racovita.mdf;Integrated Security=True"; ^ tri.cpp:37:35: error: stray '@' in program cmd.CommandText = @"select * from elevi where nume='" ^ tri.cpp:38:36: error: stray '@' in program + elevCautat + @"'"; ^ tri.cpp:66:35: error: stray '@' in program cmd.CommandText = @"select * from elevi where clasa='" ^ tri.cpp:67:38: error: stray '@' in program + clasaCautata + @"'"; ^ tri.cpp:1:7: error: expected nested-name-specifier before 'System' using System; ^ tri.cpp:1:7: error: 'System' has not been declared tri.cpp:2:7: error: expected nested-name-specifier before 'System' using System.Collections.Generic; ^ tri.cpp:2:7: error: 'System' has not been declared tri.cpp:2:13: error: expected ';' before '.' token using System.Collections.Generic; ^ tri.cpp:2:13: error: expected unqualified-id before '.' token tri.cpp:3:7: error: expected nested-name-specifier before 'System' using System.ComponentModel; ^ tri.cpp:3:7: error: 'System' has not been declared tri.cpp:3:13: error: expected ';' before '.' token using System.ComponentModel; ^ tri.cpp:3:13: error: expected unqualified-id before '.' token tri.cpp:4:7: error: expected nested-name-specifier before 'System' using System.Data; ^ tri.cpp:4:7: error: 'System' has not been declared tri.cpp:4:13: error: expected ';' before '.' token using System.Data; ^ tri.cpp:4:13: error: expected unqualified-id before '.' token tri.cpp:5:7: error: expected nested-name-specifier before 'System' using System.Data.SqlClient; ^ tri.cpp:5:7: error: 'System' has not been declared tri.cpp:5:13: error: expected ';' before '.' token using System.Data.SqlClient; ^ tri.cpp:5:13: error: expected unqualified-id before '.' token tri.cpp:6:7: error: expected nested-name-specifier before 'System' using System.Drawing; ^ tri.cpp:6:7: error: 'System' has not been declared tri.cpp:6:13: error: expected ';' before '.' token using System.Drawing; ^ tri.cpp:6:13: error: expected unqualified-id before '.' token tri.cpp:7:7: error: expected nested-name-specifier before 'System' using System.Linq; ^ tri.cpp:7:7: error: 'System' has not been declared tri.cpp:7:13: error: expected ';' before '.' token using System.Linq; ^ tri.cpp:7:13: error: expected unqualified-id before '.' token tri.cpp:8:7: error: expected nested-name-specifier before 'System' using System.Text; ^ tri.cpp:8:7: error: 'System' has not been declared tri.cpp:8:13: error: expected ';' before '.' token using System.Text; ^ tri.cpp:8:13: error: expected unqualified-id before '.' token tri.cpp:9:7: error: expected nested-name-specifier before 'System' using System.Threading.Tasks; ^ tri.cpp:9:7: error: 'System' has not been declared tri.cpp:9:13: error: expected ';' before '.' token using System.Threading.Tasks; ^ tri.cpp:9:13: error: expected unqualified-id before '.' token tri.cpp:10:7: error: expected nested-name-specifier before 'System' using System.Windows.Forms; ^ tri.cpp:10:7: error: 'System' has not been declared tri.cpp:10:13: error: expected ';' before '.' token using System.Windows.Forms; ^ tri.cpp:10:13: error: expected unqualified-id before '.' token tri.cpp:14:5: error: expected unqualified-id before 'public' public partial class Form1 : Form ^ tri.cpp:84:1: error: expected '}' at end of input } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema tri 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ă.