Codeforces Round #133 (Div. 2)(二)

2014-11-24 11:00:18 · 作者: · 浏览: 1

pre=(pre+a[i])%m;
sum[i]=pre;
}
mapmmap;
mmap.clear();
LL ans=0;
mmap[0]++;
for(int i=0;i int t=(m+sum[i]-b)%m;
if(mmap.count(t))
ans+=mmap[t];
mmap[sum[i]]++;
}
LL ret=0;
for(int i=0;i if(a[i]==0){
int j=1;
while(i+j ret+=(LL)j*(j+1)/2;
i+=j;
}
}
if(b==0) ans=ret;
else if(b==k-1) ans-=ret;
printf("%I64d\n",ans);
}
return 0;
}

作者:ACM_cxlove