264 - Count on Cantor


Difficulty : easy

Solution Description :

Ad hoc number sequence problem

Pregenerate two arrays where n[i] is the numerator of the ith term,
and d[i] is the denominator of the ith term. The pattern is fairly
simple:

Numerator: 1 12321 123454321 ...
Denominator: 121 1234321 12345654321

input m
print n[m] and d[m]