暴力写法:枚举因子,计算有多少个数含有该因子并求和,时间复杂度。 int gethead(int x) { while(x >= 10) x /= 10; return x; } LL solve(int r, int x) { LL ret; for(int i = 1; i <= r; i++) { if(gethead(i) != x) continue; ret += r / i; } return ret; } int main() { int l, r; scanf("%d...