题目:hdu1013, hdu1061, hdu1163, hdu1197.
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
时间: 2024-10-03 15:29:57
题目:hdu1013, hdu1061, hdu1163, hdu1197.
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