Skip to content

Commit 749939c

Browse files
committed
添加修正
1 parent d72f145 commit 749939c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

math/数论算法模板总结.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
#公约数
33
##gcd
44

5-
```
5+
```c++
66
LL gcd(LL a,LL b)
77
{
88
return b==0? a:gcd(b,a%b);
99
}
1010
```
1111
##ex_gcd
1212
13-
```
13+
```c++
1414
//返回值为最大公约数
1515
LL ex_gcd(LL a,LL b,LL &x,LL &y)
1616
{
@@ -27,7 +27,7 @@ LL ex_gcd(LL a,LL b,LL &x,LL &y)
2727

2828
##素因子分解
2929
$朴素算法O(\sqrt n)$
30-
```
30+
```c++
3131
void prime_factor(int n,map<int,int> &pf)//
3232
{
3333
for(int i =2 ; i*i<=n ; ++i)//n为素数时!
@@ -43,7 +43,7 @@ void prime_factor(int n,map<int,int> &pf)//
4343
```
4444
##Eratosthenes筛法
4545
46-
```
46+
```c++
4747
void Eratosthenes(int n)
4848
{
4949
memset(is_prime,true,sizeof(is_prime));
@@ -55,7 +55,7 @@ void Eratosthenes(int n)
5555
```
5656
##区间筛法
5757

58-
```
58+
```c++
5959
void segment_sieve(LL a,LL b)//[a,b]
6060
{
6161
memset(is_prime_ab,true,sizeof(is_prime_ab[0])*(b-a+1));

0 commit comments

Comments
 (0)