题意比较简单,做这种题目,应该得有一种条件反射,绝对不可能暴力,数据这么大,要么预处理要么找规律!
规律我是憨憨了没看出来看看这位大佬的https://blog.csdn.net/mrcrack/article/details/103982862
我的代码写得还算好看哈哈哈哈哈
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cmath>
#include <sstream>
using namespace std;
typedef long long ll;
int main()
{
int t = 1;
ll sum[11];
sum[0] = 0;
for (int i = 1; i <= 9; i++)
{
t = t * 10;
sum[i] = t - 1;
}
int T;
cin >> T;
while (T--)
{
ll a, b, i;
int cnt;
cin >> a >> b;
int p = lower_bound(sum, sum + 10, b) - sum;
if (b == sum[p])
cnt = p;
else
cnt = p - 1;
cout << a * cnt << endl;
}
return 0;
}