首页 > 其他 > 详细

Codeforces #330 B Pasha and Phone

时间:2015-11-12 00:00:07      阅读:381      评论:0      收藏:0      [点我收藏+]

代码先放着,明天补思路

#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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!