Cruel king and Honourable fool

Problem Name:
Cruel king and Honourable fool
Site:HackerEarth
Links:
Tags:
Problem setters: