# UVa 343

## Summary

Given two numbers n1, n2 calculate find a the bases of both numbers such that n1 (base b1)= n2 (base b2).

## Explanation

• Calculate the base 10 equivalent of n1 (base 1) and n2 (base 2) for each base and when they are equal to each other they are both equivalent.
• White space should not affect the input.

## Gotchas

• The problem states the bases are from 1 to 36 but there is no base 1 for this question!!
• Use unsigned long long just incase, the cases will most likely overflow signed int.

## Optimizations

You could generate the values for the bases and store it into an array. The lookup will save you the cost of calculating it every time.

## Input

```12   5
10     A
12 34
123   456
1    2
10   2
10 36
35 Z
Z                     35
0 0
```

## Output

```12 (base 3) = 5 (base 6)
10 (base 10) = A (base 11)
12 (base 17) = 34 (base 5)
123 is not equal to 456 in any base 2..36
1 is not equal to 2 in any base 2..36
10 (base 2) = 2 (base 3)
10 (base 27) = 36 (base 7)
35 (base 10) = Z (base 36)
Z (base 36) = 35 (base 10)
0 (base 2) = 0 (base 2)
```