generated from sigonasr2/CPlusPlusProjectTemplate
parent
afca1c8701
commit
fce397b68b
@ -1,7 +1,7 @@ |
|||||||
build.sh:c073187e65d0e23aa77aa94af4ec6382 - |
build.sh:c073187e65d0e23aa77aa94af4ec6382 - |
||||||
commit.sh:1af81bf417dfb932284d8a14fdd10657 - |
commit.sh:1af81bf417dfb932284d8a14fdd10657 - |
||||||
debug.sh:849488515cab075948653c15eec4177b - |
debug.sh:8125f303032b6cbc137223df63d10096 - |
||||||
lines.sh:3b907786f7fc9204025993016c9080de - |
lines.sh:3b907786f7fc9204025993016c9080de - |
||||||
release.sh:0ab321c3fa2f1a1b2f03b1aec3bce816 - |
release.sh:b1ce8461a303e8e7aa9ed74259db3873 - |
||||||
temp:d41d8cd98f00b204e9800998ecf8427e - |
temp:d41d8cd98f00b204e9800998ecf8427e - |
||||||
web.sh:4bbe9c5710a0ae4289468c3f7f340ff1 - |
web.sh:dd7eec9825587db99063877da2839506 - |
||||||
|
Binary file not shown.
@ -1,2 +1,3 @@ |
|||||||
#define OLC_PGE_APPLICATION |
#define OLC_PGE_APPLICATION |
||||||
|
#define OLC_PGE_HEADLESS |
||||||
#include "pixelGameEngine.h" |
#include "pixelGameEngine.h" |
Binary file not shown.
@ -0,0 +1,18 @@ |
|||||||
|
#include "utils.h" |
||||||
|
#include <cmath> |
||||||
|
|
||||||
|
std::map<internal::PowModStruct,int>utils::mapping; |
||||||
|
|
||||||
|
int utils::PowMod(int a,int b, int mod){ |
||||||
|
int shift=0; |
||||||
|
for(int n=1;n<=b;n*=2){ |
||||||
|
if(utils::mapping.find({a,n,mod})!=utils::mapping.end()){ |
||||||
|
std::cout<<internal::PowModStruct{a,n,mod}<<"="<<utils::mapping[{a,n,mod}]<<std::endl; |
||||||
|
continue; |
||||||
|
} |
||||||
|
std::cout<<std::fmod(std::pow(double(a),double(n)),double(mod))<<std::endl; |
||||||
|
utils::mapping[{a,n,mod}]=std::fmod(std::pow(double(a),double(n)),double(mod)); |
||||||
|
shift++; |
||||||
|
} |
||||||
|
return 0; |
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
#pragma once |
||||||
|
#include <map> |
||||||
|
#include <iostream> |
||||||
|
|
||||||
|
namespace internal{ |
||||||
|
struct PowModStruct{ |
||||||
|
int 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||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 int PowMod(int a,int b,int mod); |
||||||
|
}; |
Loading…
Reference in new issue