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!

ELTE

VersenyVizsga portál

Kísérletek.hu

Matematika oktatási portál

I. 109. Write a program to play the following game. The user enters ``head'' or ``tail'' in every step, which your program should guess in advance. The program should also make a statistics of its scores.

More precisely, the program reads the user's choice from the standard input, being a single letter H or T followed by an Enter. Then the program prints in one line its guess made beforehand, further, the number of its correct and incorrect guesses so far. The game is aborted by the user.

The program should make a record of the user's habits and make its decisions accordingly: the program should collect that -- depending on the last two steps and the program's guesses (being altogether 16 cases) -- heads or tails were entered more often by the user. (For example, if the user entered heads in the last two steps and the computer guessed them both correctly, then the program should examine the user's reaction in previous such situations whether heads or tails were selected more often.) If a given situation did not happen previously, or the user selected the same number of heads and tails, then the computer should guess randomly.

Example (messages from the computer are in italics):

The source code of your program (i109.pas, i109.c, ...) should be submitted.

(10 points)

Deadline expired on 17 October 2005.


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

Megoldás. Egy lehetséges Pascal program letölthető innen.


Statistics on problem I. 109.
31 students sent a solution.
10 points:Balambér Dávid, Gilián Zoltán, Gombos Gergely, Györök Péter, Hunyady Márton, Kacz Krisztián, Kovács 129 Péter, Ozsvárt László, Szentandrási István, Szoldatics András, Szolnoki Lénárd, Véges Márton, Vincze János.
8 points:8 students.
6 points:1 student.
5 points:1 student.
4 points:2 students.
2 points:3 students.
0 point:3 students.


  • Problems in Information Technology of KöMaL, September 2005

  • 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