You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
611 B

#pragma once
#include <map>
#include <iostream>
namespace internal{
struct PowModStruct{
long a,b,mod;
friend std::ostream& operator << (std::ostream& os, const internal::PowModStruct& rhs) { os << rhs.a << "^" << rhs.b << "%" << rhs.mod; return os; };
bool operator<(const internal::PowModStruct&rhs)const{return a<rhs.a||a==rhs.a&&b<rhs.b||a==rhs.a&&b==rhs.b&&mod<rhs.mod;};
};
}
class utils{
utils()=delete;
utils(utils&utils)=delete;
static std::map<internal::PowModStruct,int>mapping;
public:
//a^b % mod
static long PowMod(int a,int b,int mod);
};