Codeforces-1097D:Makoto and a Blackboard(期望+DP)

NoSuchKey