Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct big{
- static const long long MX=999999999;
- long long l,a[1024];
- big(int A=0):l(1){a[0]=A;}
- bool eq(int h){return l==1&&a[0]==h;}
- void operator=(int h){
- a[0]=h;
- l=1;
- }/*Care - if used on itself, remove '&'!*/
- void operator+=(big &b){
- for(int i(0);i<b.l;++i)
- add(b.a[i],i);
- }
- void add(long long s,int nd){
- if(nd==l)
- a[l++]=0;
- a[nd]+=s;
- if(a[nd]>MX)
- a[nd]-=MX+1,add(1,nd+1);
- }
- void prt(void){
- printf("%lld",a[l-1]);
- for(int i(l-2);~i;--i)
- printf("%09lld",a[i]);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement