题解 | #整数中1出现的次数(从1到n整数中1出现的次数)#
整数中1出现的次数(从1到n整数中1出现的次数)
http://www.nowcoder.com/practice/bd7f978302044eee894445e244c7eee6
虽然很low,但是直接嗷
public int NumberOf1Between1AndN_Solution(int n) { int i = 1; int res = 0; while (i <= n){ int cur = (i + "a").split("1").length - 1; res += cur; i++; } return res; }