eolymp
bolt
Try our new interface for solving problems

Sequence

The sequence \textbf{1}, \textbf{1010}, \textbf{2012}, \textbf{10021} may not look like an arithmetic sequence, but it is one in base \textbf{3}. Likewise, the sequence \textbf{11}, \textbf{33}, \textbf{55} is clearly an arithmetic sequence in base \textbf{10}, but it is also one in base \textbf{6}. For this problem, you will be given a sequence of numbers and you must write an Arithmetic Con rmation Machine to determine the smallest base under which the numbers form an arithmetic sequence. \InputFile Input will consist of multiple problem instances. The first line will contain a single integer \textbf{2} ≤ \textbf{n} ≤ \textbf{5} indicating the number of values in the sequence. The next line will contain the \textbf{n} numbers in strictly increasing order, separated by a single blank. A value of \textbf{n = 0} will terminate the input. All numbers will be positive and made up of the digits \textbf{0-9}exclusively, and no number will have more than \textbf{5} digits. \OutputFile Output for each instance should consist of one line of either the form \textbf{Minimum base = x.} where \textbf{x} is the the smallest base ≤ \textbf{10} which results in an arithmetic sequence, or you should output \textbf{No base <= 10 can be found.}
Zaman məhdudiyyəti 1 saniyə
Yaddaşı istafadə məhdudiyyəti 64 MiB
Giriş verilənləri #1
4
1 1010 2012 10021
3
11 33 55
4
11 33 55 77
5
10 160 340 520 1000
5
10 160 340 520 10000
0
Çıxış verilənləri #1
Minimum base = 3.
Minimum base = 6.
Minimum base = 8.
Minimum base = 7.
No base <= 10 can be found.
Mənbə ACM ICPC East Central Regional Practice Contest 2000