-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBigmod.cpp
More file actions
33 lines (28 loc) · 773 Bytes
/
Bigmod.cpp
File metadata and controls
33 lines (28 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define EPS 0.00000001
#define PI 2*acos(0.0)
#define MOD 1000000007LL
#define ck(XX) cout<<XX<<endl
#define set(XX,POS) XX|(1<<POS)
#define reset(XX,POS) XX&(~(1<<POS))
#define check(XX,POS) (bool)(XX&(1<<POS))
#define toggle(XX,POS) (XX^(1<<POS))
#define Fin freopen("input.txt","r",stdin)
#define Fout freopen("output.txt","w",stdout)
#define MS(ARRAY,VALUE) memset(ARRAY,VALUE,sizeof(ARRAY))
#define RT printf("Run Time : %0.3lf seconds\n", clock()/(CLOCKS_PER_SEC*1.0))
LL bigmod(LL a, LL b, LL M)
{
if(b == 0) return 1 % M;
LL x = bigmod(a, b/2, M);
x = (x*x)%M;
if(b%2 == 1) x = (x*a)%M;
return x;
}
int main()
{
cout<<bigmod(333333336LL,8LL,MOD)<<endl;
return 0;
}