DWITE '09 R3 #1 - Quiz Time

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
DWITE Online Computer Programming Contest, December 2009, Problem 1

Building "quiz" applications is a popular assignment/project/whatever task for students learning programming. There are many that type up 500+ lines of code, but trust me — we can do that in much less.

The idea is that we will de-couple data from code. The questions and answers themselves are not code, they are just data, and so should live in a separate data file. As such, we only need enough actual programming to display just one question — any question read from a data file. To make things more interesting though, we'll be reading the questions out of a data file in a "random" order.

The input will contain 5 sets of input: a question line no more than 255 characters long, followed by a "random" integer, order on which line the question should appear in the output. (Since we can't mark against actual random results, we'll tell you what "random" values to use).

The output will contain 5 lines, questions from the data file, arranged in the specified order.

Sample Input

question one
4
question two?
5
DWITE
2
What city is the capital of Canada?
3
meep.
1

Sample Output

meep.
DWITE
What city is the capital of Canada?
question one
question two?

Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) Problem Resource: DWITE


Comments

There are no comments at the moment.