#249
Se dă un număr natural X şi un şir cu n numere naturale distincte două câte două. Să se determine poziţia pe care s-ar afla numărul X în şirul sortat.
| Problema | PozitieX | Operații I/O |
pozitiex.in/pozitiex.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64151602 | Utilizator | |
| Fișier | pozitiex.cpp | Dimensiune | 424 B |
| Data încărcării | 20 Aprilie 2026, 17:20 | Scor/rezultat | Eroare de compilare |
pozitiex.cpp:5:1: error: expected ‘,’ or ‘;’ before ‘ofstream’ 5 | ofstream fout("pozitiex.out") | ^~~~~~~~ pozitiex.cpp: In function ‘int main()’: pozitiex.cpp:9:10: error: ‘x’ was not declared in this scope 9 | fin>>x; | ^ pozitiex.cpp:10:10: error: ‘n’ was not declared in this scope 10 | fin>>n; | ^ pozitiex.cpp:11:9: error: ‘i’ was not declared in this scope 11 | for(i=1;i<=n;i++) | ^ pozitiex.cpp:13:14: error: ‘v’ was not declared in this scope 13 | fin>>v[i]; | ^ pozitiex.cpp:15:13: error: ‘k’ was not declared in this scope 15 | k++; | ^ pozitiex.cpp:17:13: error: ‘gasit’ was not declared in this scope 17 | gasit=1; | ^~~~~ pozitiex.cpp:19:8: error: ‘gasit’ was not declared in this scope 19 | if(gasit==1) | ^~~~~ pozitiex.cpp:20:9: error: ‘fout’ was not declared in this scope 20 | fout<<k; | ^~~~ pozitiex.cpp:20:15: error: ‘k’ was not declared in this scope 20 | fout<<k; | ^ pozitiex.cpp:22:9: error: ‘fout’ was not declared in this scope 22 | fout<<"NU EXISTA"; | ^~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema PozitieX 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ă.