提交时间:2021-06-19 19:44:54

运行 ID: 20677

#include<bits/stdc++.h> using namespace std; int k,m; long long a[110][3]={{0,0,0},{0,1,1}}; void qpower(int base){ if(a[base-1][1]==0)qpower(base-1); a[base][1]=a[base-1][1]*2; a[base][1]%=1000000; //cout<<base<<endl; //cout<<"1:"<<a[base][1]<<endl; a[base][2]=a[base-1][2]*2; if(a[base][2]>=99999999)a[base][2]/=100; //cout<<"2:"<<a[base][2]<<endl; return ; } int main(){ cin>>k>>m; qpower(m); int ans=0; if(m<20){ for(int i=k;i<=m;i++){ ans+=a[i][1]; } cout<<ans; return 0; }else{ int ans1=0,ans2=0; for(int i=k;i<=m;i++){ ans1+=a[i][2]; if(ans1>=99999999)ans1/=100; } while(ans1>=999)ans1/=10; cout<<ans1<<","; for(int i=k;i<=m;i++){ ans2+=a[i][1]; if(ans2)ans2%=1000; } cout<<ans2; return 0; } return 0; }