代码先放着,明天补思路
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll modd=1000000007; ll a[100010],b[100010]; int n,k; int main() { while(scanf("%d%d",&n,&k)!=EOF) { for(int i=1; i<=n/k; i++) scanf("%I64d",&a[i]); for(int i=1; i<=n/k; i++) scanf("%I64d",&b[i]); ll cnt,sum=1;int uu=1; for(int i=0;i<k;i++) { uu*=10; } for(int i=1; i<=n/k; i++) { cnt=(uu-1)/a[i]+1; //printf("%d ",cnt); if(b[i]!=0) { ll x=((uu/10)*(b[i]+1)-1)/a[i]; ll y=((uu/10)*b[i]-1)/a[i]; //printf("%d %d ",x,y); cnt=cnt-(x-y); } else { ll x=(uu/10-1)/a[i]; cnt=cnt-x-1; //printf("%d ",x); } //printf("%d\n",cnt); sum=(sum*cnt)%modd; } printf("%d\n",sum); } return 0; }
Codeforces #330 B Pasha and Phone
原文:http://www.cnblogs.com/zzulipomelo/p/4957667.html