```cpp int countNumX2(int n, int x) { int high = n / 10; int cur = n % 10; int low = 0; int digit = 1; int res = 0; while (high != 0 || cur != 0) { if (cur < x) { res += high * digit; } else if (cur == x) { res += high * digit + low + 1; } else if (cur > x) { res += (high + 1) * digit; } low = cur * digit; cur = high % 10; high /= 10; digit *= 10; } return res; } ```
点赞 评论

相关推荐

对空六翼:你真幸运,碰见这么好的人,不像我,秋招的时候被室友骗进cx了
实习好累,可以辞职全力准...
点赞 评论 收藏
分享
03-06 18:20
门头沟学院 Java
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务