COCI '06 Contest 3 #1 Patuljci

View as PDF

Submit solution


Points: 5
Time limit: 1.0s
Memory limit: 32M

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

Every day, while the dwarves are busy in the mines, Snow White prepares dinner for them; seven chairs, seven plates, seven forks and seven knives for seven hungry dwarves. One day nine dwarves came from the mines instead of seven (nobody knows how or why), each of them claiming to be one of Snow White's seven dwarves.

Luckily, each dwarf wears a hat with a positive integer less than 100 written on it. Snow White, a famous mathematician, realised long ago that the sum of numbers on the hats of her seven dwarves was exactly 100.

Write a program which determines which dwarves are legit, i.e. pick seven of nine numbers that add to 100.

Input Specification

There are 9 lines of input. Each contains an integer between 1 and 99 (inclusive). All of the numbers will be distinct.

Note: The test data will be such that the solution is unique.

Output Specification

Your program must produce exactly seven lines of output – the numbers on the hats of Snow White's seven dwarves. Output the numbers in any order.

Sample Input 1

7
8
10
13
15
19
20
23
25

Sample Output 1

7
8
10
13
19
20
23

Sample Input 2

8
6
5
1
37
30
28
22
36

Sample Output 2

8
6
5
1
30
28
22

Comments

There are no comments at the moment.