#4253
Scrieţi un program care să citească lungimea unei linii şi textul dat şi care să alinieze textul la stânga şi la dreapta.
OJI 2003, clasa a IX-a
Problema | textOJI | Operații I/O |
![]() textoji.in /textoji.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #42724161 | Utilizator | |
Fișier | textoji.cpp | Dimensiune | 1.55 KB |
Data încărcării | 15 Martie 2023, 14:38 | Scor / rezultat | Eroare de compilare |
textoji.cpp:2:1: error: stray '\304' in program Vasile lucrează intens la un editor de texte. Un text este format din unul sau mai multe paragrafe. Orice paragraf se termină cu Enter şi oricare două cuvinte consecutive din acelaşi paragraf sunt separate prin spaţii (unul sau mai multe). În funcţie de modul de setare a paginii, numărul maxim de caractere care încap în pagină pe o linie este unic determinat (Max). ^ textoji.cpp:2:1: error: stray '\203' in program textoji.cpp:2:1: error: stray '\304' in program textoji.cpp:2:1: error: stray '\203' in program textoji.cpp:2:1: error: stray '\305' in program textoji.cpp:2:1: error: stray '\237' in program textoji.cpp:2:1: error: stray '\304' in program textoji.cpp:2:1: error: stray '\203' in program textoji.cpp:2:1: error: stray '\305' in program textoji.cpp:2:1: error: stray '\237' in program textoji.cpp:2:1: error: stray '\305' in program textoji.cpp:2:1: error: stray '\243' in program textoji.cpp:2:1: error: stray '\303' in program textoji.cpp:2:1: error: stray '\216' in program textoji.cpp:2:1: error: stray '\305' in program textoji.cpp:2:1: error: stray '\243' in program textoji.cpp:2:1: error: stray '\304' in program textoji.cpp:2:1: error: stray '\203' in program textoji.cpp:2:1: error: stray '\303' in program textoji.cpp:2:1: error: stray '\256' in program textoji.cpp:2:1: error: stray '\303' in program textoji.cpp:2:1: error: stray '\256' in program textoji.cpp:2:1: error: stray '\304' in program textoji.cpp:2:1: error: stray '\203' in program textoji.cpp:3:1: error: stray '\305' in program Funcţia pe care Vasile trebuie să o implementeze acum este alinierea în pagină a fiecărui paragraf din text la stânga şi la dreapta. Pentru aceasta el va trebui să împartă fiecare paragraf în linii separate de lungime Max (fiecare linie terminată cu Enter). Împărţirea se realizează punând numărul maxim posibil de cuvinte pe fiecare linie, fără împărţirea cuvintelor în silabe. Pentru aliniere stânga-dreapta, el trebuie să repartizeze spaţii în mod uniform între cuvintele de pe fiecare linie, astfel încât ultimul caracter de pe linie să fie diferit de spaţiu, iar numărul total de caractere de pe linie să fie egal cu Max. Excepţie face numai ultima linie din paragraf, care rămâne aliniată la stânga (cuvintele fiind separate printr-un singur spaţiu, chiar dacă linia nu este plină). ^ textoji.cpp:3:1: error: stray '\243' in program textoji.cpp:3:1: error: stray '\304' in program textoji.cpp:3:1: error: stray '\203' in program textoji.cpp:3:1: error: stray '\303' in program textoji.cpp:3:1: error: stray '\256' in program textoji.cpp:3:1: error: stray '\304' in program textoji.cpp:3:1: error: stray '\203' in program textoji.cpp:3:1: error: stray '\304' in program textoji.cpp:3:1: error: stray '\203' in program textoji.cpp:3:1: error: stray '\303' in program textoji.cpp:3:1: error: stray '\242' in program textoji.cpp:3:1: error: stray '\305' in program textoji.cpp:3:1: error: stray '\237' in program textoji.cpp:3:1: error: stray '\304' in program textoji.cpp:3:1: error: stray '\203' in program textoji.cpp:3:1: error: stray '\303' in program textoji.cpp:3:1: error: stray '\256' in program textoji.cpp:3:1: error: stray '\304' in program textoji.cpp:3:1: error: stray '\203' in program textoji.cpp:3:1: error: stray '\303' in program textoji.cpp:3:1: error: stray '\256' in program textoji.cpp:3:1: error: stray '\304' in program textoji.cpp:3:1: error: stray '\203' in program textoji.cpp:3:1: error: stray '\303' in program textoji.cpp:3:1: error: stray '\216' in program textoji.cpp:3:1: error: stray '\304' in program textoji.cpp:3:1: error: stray '\203' in program textoji.cpp:3:1: error: stray '\305' in program textoji.cpp:3:1: error: stray '\243' in program textoji.cpp:3:1: error: stray '\304' in program textoji.cpp:3:1: error: stray '\203' in program textoji.cpp:3:1: error: stray '\303' in program textoji.cpp:3:1: error: stray '\242' in program textoji.cpp:3:1: error: stray '\304' in program textoji.cpp:3:1: error: stray '\203' in program textoji.cpp:3:1: error: stray '\304' in program textoji.cpp:3:1: error: stray '\203' in program textoji.cpp:3:1: error: stray '\304' in program textoji.cpp:3:1: error: stray '\203' in program textoji.cpp:3:1: error: stray '\303' in program textoji.cpp:3:1: error: stray '\256' in program textoji.cpp:3:1: error: stray '\304' in program textoji.cpp:3:1: error: stray '\203' in program textoji.cpp:3:1: error: stray '\305' in program textoji.cpp:3:1: error: stray '\243' in program textoji.cpp:3:1: error: stray '\303' in program textoji.cpp:3:1: error: stray '\256' in program textoji.cpp:3:1: error: stray '\303' in program textoji.cpp:3:1: error: stray '\242' in program textoji.cpp:3:1: error: stray '\304' in program textoji.cpp:3:1: error: stray '\203' in program textoji.cpp:3:1: error: stray '\305' in program textoji.cpp:3:1: error: stray '\243' in program textoji.cpp:3:1: error: stray '\303' in program textoji.cpp:3:1: error: stray '\256' in program textoji.cpp:3:1: error: stray '\303' in program textoji.cpp:3:1: error: stray '\256' in program textoji.cpp:3:1: error: stray '\303' in program textoji.cpp:3:1: error: stray '\256' in program textoji.cpp:3:1: error: stray '\303' in program textoji.cpp:3:1: error: stray '\242' in program textoji.cpp:3:1: error: stray '\304' in program textoji.cpp:3:1: error: stray '\203' in program textoji.cpp:3:1: error: stray '\305' in program textoji.cpp:3:1: error: stray '\243' in program textoji.cpp:3:1: error: stray '\304' in program textoji.cpp:3:1: error: stray '\203' in program textoji.cpp:3:1: error: stray '\304' in program textoji.cpp:3:1: error: stray '\203' in program textoji.cpp:3:1: error: stray '\305' in program textoji.cpp:3:1: error: stray '\243' in program textoji.cpp:3:1: error: stray '\304' in program textoji.cpp:3:1: error: stray '\203' in program textoji.cpp:3:1: error: stray '\303' in program textoji.cpp:3:1: error: stray '\242' in program textoji.cpp:3:1: error: stray '\304' in program textoji.cpp:3:1: error: stray '\203' in program textoji.cpp:3:1: error: stray '\303' in program textoji.cpp:3:1: error: stray '\242' in program textoji.cpp:3:1: error: stray '\305' in program textoji.cpp:3:1: error: stray '\243' in program textoji.cpp:3:1: error: stray '\304' in program textoji.cpp:3:1: error: stray '\203' in program textoji.cpp:3:1: error: stray '\304' in program textoji.cpp:3:1: error: stray '\203' in program textoji.cpp:4:1: error: stray '\303' in program În general, este puţin probabil ca alinierea să fie realizabilă prin plasarea aceluiaşi număr de spaţii între oricare două cuvinte consecutive de pe linie. Vasile consideră că este mai elegant ca, dacă între unele cuvinte consecutive trebuie plasat un spaţiu în plus faţă de alte perechi de cuvinte consecutive, acestea să fie plasate la începutul liniei. ^ textoji.cpp:4:1: error: stray '\216' in program textoji.cpp:4:1: error: stray '\305' in program textoji.cpp:4:1: error: stray '\243' in program textoji.cpp:4:1: error: stray '\304' in program textoji.cpp:4:1: error: stray '\203' in program textoji.cpp:4:1: error: stray '\304' in program textoji.cpp:4:1: error: stray '\203' in program textoji.cpp:4:1: error: stray '\305' in program textoji.cpp:4:1: error: stray '\237' in program textoji.cpp:4:1: error: stray '\304' in program textoji.cpp:4:1: error: stray '\203' in program textoji.cpp:4:1: error: stray '\305' in program textoji.cpp:4:1: error: stray '\243' in program textoji.cpp:4:1: error: stray '\303' in program textoji.cpp:4:1: error: stray '\256' in program textoji.cpp:4:1: error: stray '\304' in program textoji.cpp:4:1: error: stray '\203' in program textoji.cpp:4:1: error: stray '\304' in program textoji.cpp:4:1: error: stray '\203' in program textoji.cpp:4:1: error: stray '\304' in program textoji.cpp:4:1: error: stray '\203' in program textoji.cpp:4:1: error: stray '\304' in program textoji.cpp:4:1: error: stray '\203' in program textoji.cpp:4:1: error: stray '\303' in program textoji.cpp:4:1: error: stray '\256' in program textoji.cpp:4:1: error: stray '\305' in program textoji.cpp:4:1: error: stray '\243' in program textoji.cpp:4:1: error: stray '\303' in program textoji.cpp:4:1: error: stray '\256' in program textoji.cpp:4:1: error: stray '\305' in program textoji.cpp:4:1: error: stray '\243' in program textoji.cpp:4:1: error: stray '\304' in program textoji.cpp:4:1: error: stray '\203' in program textoji.cpp:4:1: error: stray '\304' in program textoji.cpp:4:1: error: stray '\203' in program textoji.cpp:4:1: error: stray '\303' in program textoji.cpp:4:1: error: stray '\256' in program textoji.cpp:2:1: error: 'Vasile' does not name a type Vasile lucrează intens la un editor de texte. Un text este format din unul sau mai multe paragrafe. Orice paragraf se termină cu Enter şi oricare două cuvinte consecutive din acelaşi paragraf sunt separate prin spaţii (unul sau mai multe). În funcţie de modul de setare a paginii, numărul maxim de caractere care încap în pagină pe o linie este unic determinat (Max). ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema textOJI 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ă.