#2793
Considerăm următorul șir, în care n este un număr natural nenul: \( f_n = \begin{cases}
0& \text{dacă } n = 1,\\
3& \text{dacă } n = 2,\\
2 \cdot f_{n-1} – f_{n-2} + 2& \text{dacă } n > 2.
\end{cases} \)
Primii termeni ai acestui șir sunt: 0, 3, 8, 15, 24, 35, 48, 63, 80 ....
Se citesc două numere naturale din intervalul [0,109], x și y, reprezentând valorile a doi termeni aflați pe poziții consecutive în șirul dat (x<y), și se cere să se afișeze, în ordine strict descrescătoare, separați prin câte un spațiu, toţi termenii șirului mai mici sau egali cu y.
Subiect Bacalaureat 2018, sesiune august-septembrie
| Problema | PozitiiConsecutive | Operații I/O |
pozitiiconsecutive.in/pozitiiconsecutive.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #63881623 | Utilizator | |
| Fișier | pozitiiconsecutive.cpp | Dimensiune | 469 B |
| Data încărcării | 24 Martie 2026, 13:25 | Scor/rezultat | Eroare de compilare |
pozitiiconsecutive.cpp:6:1: error: expected ',' or ';' before 'int' int x,xx,y,yy,an; ^ pozitiiconsecutive.cpp: In function 'int main()': pozitiiconsecutive.cpp:8:8: error: 'an' was not declared in this scope { fin>>an; ^ pozitiiconsecutive.cpp:9:7: error: 'x' was not declared in this scope fin>>x; ^ pozitiiconsecutive.cpp:10:15: error: 'y' was not declared in this scope while (fin>>y) ^ pozitiiconsecutive.cpp:14:21: error: 'xx' was not declared in this scope xx=x/10000;yy=y/10000; ^ pozitiiconsecutive.cpp:14:32: error: 'yy' was not declared in this scope xx=x/10000;yy=y/10000; ^ pozitiiconsecutive.cpp:18:5: error: 'xx' was not declared in this scope if (xx==0&&yy==0) ^ pozitiiconsecutive.cpp:18:12: error: 'yy' was not declared in this scope if (xx==0&&yy==0) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema PozitiiConsecutive 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ă.