Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Bitnami MediaWiki
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
3440 - Buldo
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Enunț == Dorești să nivelezi terenul pe care l-ai cumpărat, care are lățimea de 1 metru și lungimea de N metri, fiind alcătuit din N zone succesive, fiecare zonă având lungimea de 1 metru. Terenul se reprezintă ca un șir de N numere naturale h1, h2, h3, …, hN reprezentând înălțimile în metri pe care le au zonele din terenul inițial, privite de la stânga spre dreapta. Pentru a nivela terenul ai închiriat un buldozer care funcționează astfel. Se alege o înălțime H (număr natural) la care ridicăm lama buldozerului. Inițial buldozerul are pe lamă o cantitate C=0 metri cubi de pământ. Buldozerul începe să mergă de la stânga la dreapta și când ajunge la zona i, în funcție de înălțimea hi a acesteia, se va afla în una dintre următoarele situații: - dacă hi ≥ H atunci cantitatea suplimentară hi - H se adaugă la C și nivelul zonei ajunge la H. - dacă hi < H atunci se scade din C diferența H - hi pentru a aduce nivelul zonei la nivelul H. Remarcăm faptul că H trebuie ales inițial astfel încât de fiecare dată când buldozerul ajunge în a doua situație să aibă pe lamă suficient pământ (C ≥ H - hi). După ce buldozerul parcurge cele N zone de lungime 1 pe lama buldozerului e posibil să mai rămână pământ, dar asta nu te interesează, pentru că la capătul din dreapta al terenului este un râu, și pământul rămas se va vărsa acolo.
Summary:
Please note that all contributions to Bitnami MediaWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Bitnami MediaWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width