 All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars  perplexus dot info  Quiz Results III (Posted on 2014-02-10) Each of the five students - Andy, Danny, Ellen, Janice and Sammy received different marks in a mathematics quiz which was held last week. Students who made correct statements had obtained higher scores than those who made incorrect statements.

The following are the statements made by the five students:

Sammy: Andy and Ellen gained the top two places.
Janice: No, what Sammy just said is incorrect.
Danny: I was ranked in between Sammy and Janice.
Andy: Janice came second.
Janice: I had obtained a lower score than Ellen.
Ellen: Exactly three of the previous five statements are correct.

Determine the order in which the five students finished.

 No Solution Yet Submitted by K Sengupta No Rating Comments: ( Back to comment list | You must be logged in to post comments.) computer solution | Comment 2 of 4 | CLS
FOR a = 1 TO 5
used(a) = 1
FOR d = 1 TO 5
IF used(d) = 0 THEN
used(d) = 2
FOR e = 1 TO 5
IF used(e) = 0 THEN
used(e) = 3
FOR j = 1 TO 5
IF used(j) = 0 THEN
used(j) = 4

s = 15 - a - d - e - j
used(s) = 5

strue = (a < 3 AND e < 3)
j1true = NOT strue
dtrue = (d < s AND d > j OR d > s AND d < j)
atrue = (j = 2)
j2true = (j > e)
ptruect = ABS(strue + j1true + dtrue + atrue + j2true)
etrue = (ptruect = 3)
t(a) = ABS(atrue)
t(d) = ABS(dtrue)
t(e) = ABS(etrue)
t(j) = ABS(j1true)
t(s) = ABS(strue)
good = 1
FOR i = 1 TO 4
IF t(i) = 0 AND t(i + 1) = 1 THEN good = 0
NEXT
t(j) = ABS(j2true)
FOR i = 1 TO 4
IF t(i) = 0 AND t(i + 1) = 1 THEN good = 0
NEXT
' IF j1true <> j2true THEN good = 0
IF good THEN
FOR i = 1 TO 5
IF used(i) = 4 AND j1true <> j2true THEN
PRINT "j x    ";
ELSE
PRINT MID\$("adejs", used(i), 1); t(i); "   ";
END IF
NEXT
IF j1true = j2true THEN PRINT "*";
PRINT
END IF

used(s) = 0

used(j) = 0
END IF
NEXT
used(e) = 0
END IF
NEXT
used(d) = 0
END IF
NEXT
used(a) = 0
NEXT

lists some possibilities, with the starred one being the expected answer, in which Janice did not alternate truth with falsehood:

a 1    j x    s 0    d 0    e 0
a 1    j x    e 0    s 0    d 0
a 1    j x    s 0    e 0    d 0
j x    a 0    s 0    d 0    e 0
j x    a 0    e 0    s 0    d 0
j x    a 0    s 0    e 0    d 0
j x    s 0    a 0    d 0    e 0
e 1    j 1    a 1    s 0    d 0    *
j x    e 0    a 0    s 0    d 0
j x    s 0    a 0    e 0    d 0
j x    s 0    d 0    a 0    e 0
j x    e 0    s 0    a 0    d 0
j x    s 0    e 0    a 0    d 0
j x    s 0    d 0    e 0    a 0
j x    e 0    s 0    d 0    a 0
j x    s 0    e 0    d 0    a 0

where the scores are listed from highest to lowest, and a 1 next to the name indicating truth and a zero falsehood.

In the non-starred cases, Janice told one lie and one truth, indicated by an x. In a sense it could be said in these cases that "students who made correct statements had obtained higher scores than those who made incorrect statements", especially the first three cases, where a strict truth teller finished ahead of Janice.

 Posted by Charlie on 2014-02-10 12:57:57 Please log in:

 Search: Search body:
Forums (0)