Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long LL;
- const LL tt=1e9+7;
- const double l_2=log10(2.0);
- inline LL power(LL a,LL b){
- LL ret=1,w=a%b;
- while (b){
- if (b&1)ret=(ret*w)%tt;
- b>>=1,w=(w*w)%tt;
- }
- return ret;
- }
- LL n,l,ans_1,ans_2;
- inline LL tc(double x){
- return x<0?0:trunc(x);
- }
- inline LL work_1(LL x,LL l){
- double ret=0,xx=x,ll=log10((double)(l*1.0)),ll_1=log10((double)((l+1)*1.0));
- for (double i=0;i<=x;i=i+1.0)
- ret+=tc(i*l_2-ll)-tc(i*l_2-ll_1);
- return trunc(ret)+(l<=2);
- }
- inline LL work_2(LL x){
- return (power(2,x+2)-5+tt)%tt;
- }
- int main(){
- scanf("%lld%lld",&n,&l);
- ans_1=work_1(n,l)+((l==4)||(l==8)),ans_2=work_2(ans_1);
- printf("%lld\n%lld",ans_1,ans_2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement