[https://leetcode-cn.com/problems/abbreviating-the-product-of-a-range/](力扣 2117)
记
1.p 末尾 0 的个数 等价于 p 的因数分解中 2 的个数 与 5 的个数,两者较小值
2.p 最高 五位数:
class Solution { public: string abbreviateProduct(int left, int right) { int two = 0, five = 0; for (int i = left; i <= right; ++ i) { int t = i; while (t % 2 == 0) t /= 2, ++ two; while (t % 5 == 0) t /= 5, ++ five; } int cnt = min(two, five); two = five = cnt; long long back = 1, back2 = 1; int f = 0; for (int i = left; i <= right; ++ i) { int t = i; while (two > 0 && t % 2 == 0) t /= 2, -- two; while (five > 0 && t % 5 == 0) t /= 5, -- five; back = (back * t) % 100000; if (!f) { back2 = back2 * t; if (back2 >= 10000000000LL) f = 1; } } string ret = ""; if (!f) { ret = to_string(back2) + "e" + to_string(cnt); return ret; } double e = 0; for (int i = left; i <= right; ++ i) e += log10(i); long long hight = pow(10, e - (long long) e + 4); char buffer[20] = {0}; snprintf(buffer, 20, "%05lld", back); ret = to_string(hight) + "..." + string(buffer) + "e" + to_string(cnt); return ret; } };