Comments

Ah, I see your point. Thank you for your help! :D

I have a question about Problem B: Since I need to find 2 numbers, A and B, for the input number N such that, a) A + B = N and b) sumofdigits(A) — sumofdigits(B) is at most 1, could I not just use the approach where I do the following:

  • if N is even, assign N/2 to both A and B; --> ensures that sumofdigits(A) — sumofdigits(B) = 0
  • if N is odd, assign N/2 to A, and (N/2)+1 to B; --> ensures that sumofdigits(A) — sumofdigits(B) = 1

Could someone please clarify this for me, since I think I misunderstood the question?