题目:hdu1013, hdu1163, 51nod1116.
or
dr(n) = (n-1)%9+1.
其中,n-1是为了将结果0-8匹配到1-9.
Reference:
[1] https://en.wikipedia.org/wiki/Digital_root
[2] https://en.wikipedia.org/wiki/Casting_out_nines
2021-08-13 23:18:26
题目:hdu1013, hdu1163, 51nod1116.
or
dr(n) = (n-1)%9+1.
其中,n-1是为了将结果0-8匹配到1-9.
Reference:
[1] https://en.wikipedia.org/wiki/Digital_root
[2] https://en.wikipedia.org/wiki/Casting_out_nines