Codeforces 1288B Yet Another Meme Problem
题目链接:
Codeforces 1288B Yet Another Meme Problem
思路:
设代表正整数的位数;
即求方程解的对数
两边约分可得
因此答案即为解的个数乘以所能取得的值的个数
代码:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
#ifdef MyTest
freopen("Sakura.txt", "r", stdin);
#endif
int t;
cin >> t;
while(t--){
ll a, b;
cin >> a >> b;
bool flag = 1;
ll tmp = b, ans = 0;
while(b){
ll x = b % 10;
if(x != 9) flag = 0;
++ans;
b /= 10;
}
if(!flag) --ans;
cout << 1ll * a * ans << '\n';
}
return 0;
}