Mathematical and Physical Journal
for High Schools
Issued by the MATFUND Foundation
 Already signed up? New to KöMaL?

# Problem I. 334. (December 2013)

I. 334. This exercise is based on the simple game Bingo played with 90 numbers and popular in the U.S. and Australia. In this version players get 3 times 5 numbers. Based on these 5-tuples, three winners are selected:

- the first winner is the player who first has a complete 5-tuple drawn (A),

- the second winner is the player who first has two complete 5-tuples drawn (B),

- the third winner is the player who first has all three complete 5-tuples drawn (C).

The first line of the file bingo.txt contains the numbers from 1 to 90 in the order they were drawn. The next few lines contain the 5-tuples for each player (altogether 15 numbers for each person) separated by a space. The three 5-tuples of a player are the numbers in this list between positions 1 to 5, 6 to 10, and 11 to 15, respectively. The file contains data for at most 100 players. The input file and a screenshot can be downloaded from our web page.

Write a program named i334 to solve the following tasks. The program should display the number of each task first (for example: 5th task''). If your program needs user input, print the corresponding message as well (for example: ''Enter the player's number.''). You may omit diacritical marks when displaying messages.

1. Load the contents of the file and save them in a data structure with three 5-tuples for each player.

2. Display on the screen the number of players.

3. Prompt for a number and display on the screen the number of draw it was selected in.

4. Determine and display (on the screen, and separated by a space) the numbers that were not present on any player's sheet.

5. Prompt for a player's number and a draw number. Display on the screen every number of that player, with an !'' symbol after a number already drawn.

6. Create a function melyikutan to determine the draw number for a 5-tuple after which all 5 elements of the tuple were drawn. Variables in connection with the drawn numbers can be used as global variables.

7. Determine the winners. One player can win several times. There can be more winners in a case A/B/C, but it is sufficient to determine one of them. You should display the type of the winner (A, B or C) in each line, and the number of the winner(s).

8. Create a random draw order. The numbers should be written in the first line of the file huzas.txt, separated by commas.

The source code (i334.pas, i334.cpp, ...) together with a short documentation (i334.txt, i334.pdf, ...) - also describing which developer environment to use for compiling your source - should be submitted.

(10 pont)

Deadline expired on January 10, 2014.

Sorry, the solution is available only in Hungarian. Google translation

A versenyzők hétféle nyelven készült megoldást küldtek be. 5 C++, 3-3 Visual Basic és FreePascal, 2-2 C# és Java, 1-1 C és Lazarus.

A feladat összességében nem bizonyult nehéznek, bár a 7. részfeladatot csak kevesebb, mint a versenyzők fele tudta tökéletesen megoldani.

A 6. részfeladat egy függvény elkészítését írta elő, de többen jól láthatóan nem voltak tisztában a függvény programon belüli szerepével, így csak formailag tekinthető függvénynek az elkészült alkotás.

A 8. részfeladat egy 90 hosszú számsor véletlenszerű sorrendbe állítását kérte. Sokan sokféle módszerrel próbálkoztak. Kevesen alkalmazták azt az ismert módszert, hogy egy ciklus futtatunk 90-től 2-ig (ciklusváltozó n), egy számot választunk az [1,n] intervallumból, amely által megadott helyen lévő értéket az n. értékkel felcseréljük.

Az értékelés leírása: bingoertekeles.pdf

Az értékelés során használt fájlok: bingok.txt, bingon.txt

A beküldők közül ezúttal Tegzes Tamás munkáját emeljük ki: i334tegzes.pas, valamint érdekességképpen egy Python nyelven született, versenyen kívüli megoldást: bingo.py

### Statistics:

 17 students sent a solution. 10 points: Csernák Tamás, Gercsó Márk, Kovács Balázs Marcell, Tegzes Tamás. 9 points: Fehér Balázs, Fényes Balázs, Kelkó Balázs, Kovács 246 Benedek, Németh 123 Balázs, Uzonyi 000 Ákos. 8 points: 1 student. 7 points: 2 students. 6 points: 2 students. 5 points: 1 student. 4 points: 1 student.

Problems in Information Technology of KöMaL, December 2013