Logarithm , Big Integers, Basic Math, DP
In each test case T you are given a number of books N (1 \le N \le 10^5) , after every year his collection becomes N times of last year.And you are asked to find out length of that number which is equal to total number of pages in total number of books, where number of pages in N books is equal to permutation of N .
You are given N number of books and total number of pages in N books is equal to permutation of N .
Total number of pages in first year = N!
Every year collection becomes N times of last year .
Now total number of pages in second year = N! * N!
After N year total number of pages = N! * N! * N! * ...... N times
Hence total no of pages = (N!)^N
So the answer is length of (N!)^N
Author’s solution can be found here.