标签:style blog class code tar c
#include <stdio.h> #include <string.h> long long a, b; long long solve(long long left) { if (left < 0) return 0; long long ans = 1, mid, right = 0, j = 1; while (left >= 10) { mid = left % 10; left /= 10; if (mid) ans += left * j; else ans += (left - 1) * j + right + 1; right = right + mid * j; j *= 10; } return ans; } int main() { while (~scanf("%lld%lld", &a, &b) && a != -1 || b != -1) { printf("%lld\n", solve(b) - solve(a - 1)); } return 0; }
UVA 11038 - How Many O's?(计数问题),布布扣,bubuko.com
UVA 11038 - How Many O's?(计数问题)
标签:style blog class code tar c
原文地址:http://blog.csdn.net/accelerator_/article/details/25503653