D. Digits
题意
给定一个长度为n的数组a和一个k,求数组中最大的元素乘积的尾数为k
(每个元素只能用一次),输出方案数
1<= ai <= 1000
1 <= n <= 1e5
0 <= k <= 9
思路
很容易想到是01背包求方案数,但是乘积很大会爆long long,log x 也是满足递增情况,和乘积的递增表示类似,能够很好的把 * 转换为 +。
代码
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define x first
#define y second
//#define int long long
typedef pair<int ,int > PII;
typedef long long ll;
const int N = 1e5 + 10;
const double eps = 1e-6;
int a[N];
doub