Hello Guys. I've solved problem above in the title, but I very fill bad yourself on my solutions.
code:
static void Main(string[] args) { long k = long.Parse(Console.ReadLine());
long l = long.Parse(Console.ReadLine());
long stepen = (long)Math.Round(Math.Log(l, k) - 0.4);
long result = k;
for (int i = 0; i < stepen - 1; i++)
{
result = result * k;
}
if (result == l)
{
Console.WriteLine("YES");
Console.WriteLine(stepen - 1);
}
else
{
Console.WriteLine("NO");
}
}I suppose, there is another good approach how I can determine accuracy of degree. One of the unpleasant things that when we compute Math.log(1000000000,10) then result is 8.9~
Any suggestions will be very appreciated.








May be you can add a very small number before turn the double to int