提交时间:2021-06-20 15:52:42

运行 ID: 20842

#include<bits/stdc++.h> using namespace std; string add(string a,string b){ string c="000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; int _=max(a.size(),b.size()),_1,_2=0; while(a.size()>_) a="0"+a; while(b.size()>_) b="0"+b; for(int i=a.size()-1;i>=0;i++){ _1=(a[i]-'0')+(b[i]-'0')+_2; c[i]=_1%10+'0'; _2=_1/10; } if(_2==1) c="1"+c; return c; } int k,m; string ans="0",dl; int main(){ scanf("%d,%d",&k,&m); for(int i=k;i<=m;i++){ dl='1'; for(int j=1;j=i-1;j++){ dl=add(dl,dl); } ans=add(ans,dl); } if(ans.size()<=6) cout<<ans.substr(0,3)<<','<<ans.substr(ans.size()-3); else cout<<ans; return 0; }