1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #include "socketio.hpp"
- #include "BigInt64.hpp"
- #include <xoshiro.hpp>
- #include <iostream>
- #include <chrono>
- unsigned long long nanoTime(){
- using namespace std;
- using namespace std::chrono;
- return duration_cast<nanoseconds>(high_resolution_clock::now().time_since_epoch()).count();
- }
- template<typename T>
- std::ostream& operator<<(std::ostream& out, std::vector<T> o){
- out << "[";
- for(unsigned int i = 0;i < o.size();i++){
- if(o[i] == '\r')continue;
- out << o[i];
- if(i < o.size() - 1)
- out << ", ";
- }
- return out << "]";
- }
- template<>
- std::ostream& operator<< <char>(std::ostream& out, std::vector<char> o){
- for(unsigned int i = 0;i < o.size();i++){
- out << o[i];
- }
- return out;
- }
- int main(){
- xoshiro_256 gen(1);
- BigInt a(323);
- BigInt b(343453423ull);
-
- BigInt mod("179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624227998859");
- mod.suba(BigInt(234723947982312ull));
- std::cout << "Mod " << mod.toString() << std::endl;
- std::cout << mod.rawString() << std::endl;
- std::cout << "(" << a.toString() << " ^ " << std::flush;
- a = a.modPow(b,mod);
- std::cout << "" << b.toString() << ")";
- std::cout << " mod " << mod.toString() << "\n";
- std::cout << " = " << a.toString() << "\n";
- }
|