Codeforces B. Digital root 1107B Educational Codeforces Round 59 (Rated for Div. 2)


Problem link

The key observation is that the digital root of an integer k is the single-digit number 1 ≤ d ≤ 9 such that . You can prove this by noticing that  for all p. Once we observe this, finding the k-th number is very simple;

A solution in c++




Post a Comment

0 Comments