-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalgo.cpp
More file actions
executable file
·53 lines (53 loc) · 1.01 KB
/
algo.cpp
File metadata and controls
executable file
·53 lines (53 loc) · 1.01 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll m=1e9+7;
ll euclid_gcd(ll a,ll b){
if(b==0){
return a;
}
return euclid_gcd(b,a%b);
}
vector<bool> sieve(ll n){
vector<bool>arr(n+1,1);
arr[0]=0;
arr[1]=0;
for(int i=2;i*i<=n;i++){
if(arr[i]){
for(int j=i*2;j<=n;j+=i){
arr[j]=0;
}
}
}
return arr;
}
ll mod_add(ll a,ll b,ll m){
return (a % m + b % m) % m;
}
ll mod_minus(ll a,ll b,ll m){
return (a % m - b % m) % m;
}
ll mod_mul(ll a,ll b,ll m){
return (a % m * b % m) % m;
}
ll binary_expo(ll a,ll b){
int ans=1,base=a;
while(b>0){
if(b%2==0){
base*=base;
b=b/2;
}
else{
ans=ans*base;
b=b-1;
}
}
return ans;
}
ll modulo_div(ll a,ll b,ll m){
return mod_mul(a,binary_expo(b,m-2),m);
}
signed main(){
cout<<"hello world"<<endl;
return 0;
}