|
@@ -52,9 +52,16 @@ struct BigInt{
|
|
inline BigInt(const BigInt& o) : data(o.data), signum(o.signum){}
|
|
inline BigInt(const BigInt& o) : data(o.data), signum(o.signum){}
|
|
inline BigInt(BigInt&& o) : data(std::move(o.data)), signum(o.signum){}
|
|
inline BigInt(BigInt&& o) : data(std::move(o.data)), signum(o.signum){}
|
|
inline BigInt(const std::string& o){
|
|
inline BigInt(const std::string& o){
|
|
|
|
+ signum = 1;
|
|
auto it = o.rbegin();
|
|
auto it = o.rbegin();
|
|
BigInt baseTen(1);
|
|
BigInt baseTen(1);
|
|
while(it != o.rend()){
|
|
while(it != o.rend()){
|
|
|
|
+ if(*it == '-'){
|
|
|
|
+ assert(it != o.rbegin());
|
|
|
|
+ assert((++it) == o.rend());
|
|
|
|
+ signum = -1;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
BigInt l = baseTen.mult(BigInt(*it - '0'));
|
|
BigInt l = baseTen.mult(BigInt(*it - '0'));
|
|
adda(l);
|
|
adda(l);
|
|
baseTen = baseTen.mult(BigInt(10));
|
|
baseTen = baseTen.mult(BigInt(10));
|
|
@@ -596,7 +603,7 @@ struct BigInt{
|
|
t.moda(mod);
|
|
t.moda(mod);
|
|
o.suba(BigInt(1));
|
|
o.suba(BigInt(1));
|
|
}
|
|
}
|
|
- std::cout << "Reduced" << std::endl;
|
|
|
|
|
|
+ //::cout << "Reduced" << std::endl;
|
|
o.trim();
|
|
o.trim();
|
|
if(o == 1){t = t.mult(odd);t.moda(mod);return t;}
|
|
if(o == 1){t = t.mult(odd);t.moda(mod);return t;}
|
|
}
|
|
}
|