KöMaL - Középiskolai Matematikai és Fizikai Lapok
 English
Információ
A lap
Pontverseny
Cikkek
Hírek
Fórum

Rendelje meg a KöMaL-t!

VersenyVizsga portál

Kísérletek.hu

Matematika oktatási portál

I. 182. Prepare your program to simulate the motion of cars in a roundabout using a character display. The roundabout connects two perpendicular roads. Roads are numbered from 1 to 4 anticlockwise. If a car plans to travel further on road nafter it has left the roundabout, it is marked with that number n. (A car can also turn back: the incoming road segment can be the same as the outgoing one after one full round.)

In each simulation step a new car appears with probability pi (i\le4) at the beginning of each lane on the border of the grid (provided that the first square of the ith road is free). These probabilities are real numbers between 0 and 1, and are given as the first four command line arguments to your program. Cars move with constant speed until the next square in front of them is free. If they catch a slower car, the faster one temporarily adjusts its speed to the slower one. Speeds are expressed by integers between 1 and 5. Value 1 means that the car moves forward in each step (if possible), while 5 means it tries to proceed forward only in every fifth step, otherwise it stays at rest. Cars waiting to enter the roundabout should give way to those already in there. Outgoing cars disappear on the border of the grid (see the figure).

When SPACE is pressed, the simulation should stop. Keys from 1 to 9 control the speed of your simulation.

The source code of your program (i182.pas, i182.cpp, ...) and a short documentation (i182.txt, i182.pdf, ...) should be submitted containing a description of your solution and specifying the developer environment to compile your code.

(10 points)

Deadline expired on 15 April 2008.


Google Translation (Sorry, the solution is published in Hungarian only.)

Egy Pascal és egy C++ megoldást közlünk mintaként: Fábián András 11. osztályos szegedi versenyző (i182.pas) és Szabó Gábor 10. osztályos budapesti diák munkáját (i182.cpp,i182.pdf).


Statistics on problem I. 182.
7 students sent a solution.
10 points:Fábián András, Horváth 135 Loránd, Szabó 313 Gábor, Véges Márton.
8 points:1 student.
7 points:1 student.
3 points:1 student.


  • Problems in Information Technology of KöMaL, March 2008

  • Támogatóink:   Ericsson   Cognex   Emberi Erőforrás Támogatáskezelő   Emberi Erőforrások Minisztériuma   Nemzeti Tehetség Program    
    MTA Energiatudományi Kutatóközpont   MTA Wigner Fizikai Kutatóközpont     Nemzeti
Kulturális Alap   ELTE   Morgan Stanley