Editorialist: Yogesh Yogendra




Number Theory


Santa wants to give some gifts to Chef. So Santa told Chef that choose a number(N) and drop that number in a shocks and Santa will give gifts according to that number. Santa decided that he will form a string by taking N number of 9’s,and he will square that string and then he will sum up the digits of string. Now this new formed number will be the amount of candies that Santa will give to Chef.
For example: If N is 2 then String will be “99” now after squaring this string, the new string will become 99^2 = “9801”, now the amount of candies will be sum of digits i.e 9+8+0+1 = 18
Now Santa will return 18 Candies. But the problem is that Santa is not good in maths, so Santa told you to find this number.


Here we can see that for any N,after forming the required number i.e take N no’s of 9 and square that number.
We can see that sum of digits of required number will become equal to sum of digits of original number. So our question is reduced to find sum of digits of the original number and we can see that
only 9 is present in the original number so sum of digits will be (9*N).


#define int long long int
using namespace std;

int32_t main()
    int n;
    int ans = n*9;
    return 0;