Digit Root ---- 余九定理

转载请注明出处:http://www.cnblogs.com/wubdut/p/4739754.html

题目: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

原文地址:https://www.cnblogs.com/wubdut/p/4739754.html