#4653
expresie11
Se consideră un număr natural format din n
cifre. Inserând între cifrele numărului dat p
operatori +
şi q
operatori -
se obţine o expresie aritmetică. Un operator poate fi inserat doar între două cifre, deci înaintea primei cifre a numărului nu se poate plasa un operator.
Scrieţi un program care, pentru un număr dat, determină valoarea maximă a unei expresii aritmetice care se poate obţine inserând p
operatori +
şi q
operatori -
între cifrele numărului dat.
ONI 2024, clasa a 7-a
Problema | expresie11 | Operații I/O |
![]() expresie.in /expresie.out
|
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #58567489 | Utilizator | |
Fișier | expresie11.cpp | Dimensiune | 3.85 KB |
Data încărcării | 20 Iunie 2025, 16:03 | Scor / rezultat | 31 puncte |
expresie11.cpp: In member function 'BigInt BigInt::operator+(const BigInt&) const': expresie11.cpp:44:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while (i < digits.length() || j < other.digits.length() || carry) { ^ expresie11.cpp:44:63: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while (i < digits.length() || j < other.digits.length() || carry) { ^ expresie11.cpp:46:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (i < digits.length()) { ^ expresie11.cpp:49:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (j < other.digits.length()) { ^ expresie11.cpp: In member function 'BigInt BigInt::operator-(const BigInt&) const': expresie11.cpp:65:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < digits.length(); ++i) { ^ expresie11.cpp:67:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (i < other.digits.length()) { ^
Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
---|---|---|---|---|---|---|
1 | 0 secunde | OK. | 2 | 2 | ||
2 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
3 | 0 secunde | OK. | 2 | 2 | ||
4 | 0 secunde | OK. | 3 | 3 | ||
5 | 0 secunde | Raspuns gresit. | 3 | 0 | ||
6 | 0 secunde | OK. | 3 | 3 | ||
7 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
8 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
9 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
10 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
11 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
12 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
13 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
14 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
15 | 0 secunde | Raspuns gresit. | 3 | 0 | ||
16 | 0 secunde | Raspuns gresit. | 3 | 0 | ||
17 | 0 secunde | Raspuns gresit. | 3 | 0 | ||
18 | 0 secunde | Raspuns gresit. | 6 | 0 | ||
19 | 0 secunde | Raspuns gresit. | 6 | 0 | ||
20 | 0 secunde | Raspuns gresit. | 6 | 0 | ||
21 | 0 secunde | Raspuns gresit. | 7 | 0 | ||
22 | 0 secunde | Raspuns gresit. | 7 | 0 | ||
23 | 0 secunde | OK. | 7 | 7 | ||
24 | 0 secunde | OK. | 7 | 7 | ||
25 | 0 secunde | Raspuns gresit. | 7 | 0 | ||
26 | 0 secunde | OK. | 7 | 7 | ||
Punctaj total | 31 |
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema expresie11 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ă.