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

Problem I. 328. (October 2013)

I. 328. During a criminal investigation a detective is interviewing some witnesses. Your task is to reveal if there is any logical contradiction in the statements made by the witnesses. To this end, you should create a program to process (not sentences but) expressions consisting of logical operations (the ``not'', ``and'', ``or'' and ``implies'' operations, denoted by the !, &, |, and > symbols, respectively) and the first 10 letters of the English alphabet. The operator precedence is the usual one in mathematics or in computer programming; the precedence can be modified by parentheses.

Each line of the input file contains an expression; each such expression is a true statement made by a witness. The first line of the output file should contain the line number of the input file such that its corresponding statement contradicts the earlier ones. If there is no contradiction, the first line of the output file should be ``0''. In the example, ``Bemenet'' is an input, while ``Kimenet'' is the corresponding output. The first command line argument to your program is the name of the input file, while the second parameter is the name of the output file.

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

(10 pont)

Deadline expired on November 11, 2013.


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

A beküldők ötféle nyelven dolgoztak, 4 FreePascal, 3 C++, 2 Java, 1-1 C# és VB nyelven született megoldás érkezett.

Többen alkalmazták azt a kézenfekvő módszert, hogy az elvileg lehetséges 1024 esetet (10 szabad változó szerepelhetett legfeljebb) érdemes megvizsgálni. A vizsgált állítások halmazát egyenként bővítve, ha már nincs olyan eset, amelynél minden állítás igaz, akkor megtaláltuk az ellentmondást adó állítást, amelynek a sorszámát a kimenetbe ki kell írni.

Két, minden tesztesetre helyes kimenetet adó megoldást közlünk, az egyik Fényes Balázsé ( i328fenyes.cs), a másik pedig Uzonyi Ákosé (I328uzonyi.java)

A legjobban sikerült dokumentáció Kovács Balázs Marcellé volt. ( i328.txt) Ez utóbbit azért emelem ki, mert a beküldők fele nem csatolt érdemi dokumentációt munkájához. Hasonlóképp többen elfeledkeztek arról, hogy a bemeneti fájl nevét parancssori argumentumból kell olvasni.

Az értékelés kapcsán használt tesztesetek (i328teszt.zip), amelyben 6 tesztesetcsoport található. A pontok teszesetcsoportonként jártak. Emellett a dokumentáció 2 pontot ér, a be- és kimeneti fájlkokat feladatszövegnek megfelelő módon kezelő programért járt még 1 pont. Aki válaszainak többsége jó volt, még egy pontot kap.


Statistics:

11 students sent a solution.
10 points:Csernák Tamás, Fényes Balázs, Uzonyi 000 Ákos.
9 points:Kovács Balázs Marcell.
5 points:1 student.
3 points:1 student.
2 points:2 students.
1 point:3 students.

Problems in Information Technology of KöMaL, October 2013