COCI '06 Contest 4 #3 Prsteni

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

After an exhausting morning, Mirko fell asleep. His brother Stanko, however, just awoke and, like his brother, is all about excitement. Stanko found N rings of varying radiuses in the garage. He arranged them on the floor so that each ring (except the first and last) touches the ones before and after it.

He started turning the first ring and noticed that the other rings turned as well; some faster, some slower!

Thrilled with his discovery, he decided to count how many times the other rings turn while the first ring turns once. He gave up after noticing that this number is not always an integer and not knowing what to do.

Write a program that determines how many times each ring turns while the first turns once.

Input Specification

The first line of input contains an integer N (3 \le N \le 100), the number of rings.

The next line contains N integers between 1 and 1\,000, the radii of Stanko's rings, in the order they are laid out on the floor.

Output Specification

The output must contain N-1 lines. For every ring other than the first, in the order they are given in the input, output a fraction A/B, meaning that the respective ring turns \frac A B times while the first ring turns once. The fractions must be in reduced form (the numerator and denominator must not have a common divisor larger than 1).

Sample Input 1

8 4 2

Sample Output 1


Sample Input 2

12 3 8 4

Sample Output 2


Sample Input 3

300 1 1 300

Sample Output 3



There are no comments at the moment.