数学规律:
https://en.wikipedia.org/wiki/Digital_root
代码:
public class Solution { public int addDigits(int num) { return 1+(num-1)%9; } }