【BZOJ 4542】大数 【莫队】
思路:当P!=2或5时,显然10^x%P!=0
把后缀模P的值搞出来
于是问题就便成询问区间内%P为x的分别有多少个
这个再套一个莫队就可以了。
我的代码压行比较丑,我放std的代码。
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
const int maxn=100010;
typedef long long ll;
using namespace std;
struct quer{
int l,r,id;}q[maxn];
ll ans[maxn],mod,a[maxn],n,m,pw[maxn],b[maxn],c[maxn],bel[maxn],tot,sz,cnt[maxn],now=0,scnt[maxn],ssum[maxn];char s[maxn];