科学公式测试
测试
$$E=mc^2$$
假定n<m
$$ \sum_{isprime(p)}\sum_{a=1}^n\sum_{b=1}^mgcd(a,b)==p $$
$$ \sum_{isprime(p)}\sum_{a=1}^{\left \lfloor \frac{n}{p} \right \rfloor}\sum_{b=1}^{\left \lfloor \frac{m}{p} \right \rfloor}gcd(a,b)==1 $$
$$ \sum_{isprime(p)}\sum_{a=1}^{\left \lfloor \frac{n}{p} \right \rfloor}\sum_{b=1}^{\left \lfloor \frac{m}{p} \right \rfloor}\sum_{d|a\&d|b}\mu(d) $$
$$ \sum_{isprime(p)}\sum_{d=1}^{\left \lfloor \frac{n}{p} \right \rfloor}\mu(d) {\left \lfloor \frac{n}{pd} \right \rfloor}{\left \lfloor \frac{m}{pd} \right \rfloor} $$
但是做到这里我们发现直接枚举质数仍然会出事TAT,继续搞
$$ \sum_{isprime(p)\&p|d}\sum_{d}^{n} \mu \left( \frac{d}{p} \right) {\left \lfloor \frac{n}{d} \right \rfloor}{\left \lfloor \frac{m}{d} \right \rfloor} $$
令$$ f(d)=\sum_{isprime(p)\&p|d}\mu \left( \frac{d}{p} \right) $$
则原式变为
$$ \sum_{d=1}^{n} {\left \lfloor \frac{n}{d} \right \rfloor}{\left \lfloor \frac{m}{d} \right \rfloor}f(d) $$
联系 \( \mu \) 函数的定义,设h为d的质因子个数,g为d质因子指数和可得
$$ f(d)= \begin{cases} -\mu \left (d \right ) s& h=g\\ \left ( -1 \right )^s& h+1=g\\ 0& Otherwise \end{cases} $$
Inline 行内的公式 \( E=mc^2 \) 行内的公式。
$$c = \pm\sqrt{a^2 + b^2}$$
$$x > y$$
$$f(x) = x^2$$
$$\alpha = \sqrt{1-e^2}$$
$$(\sqrt{3x-1}+(1+x)^2)$$
$$\sin(\alpha)^{\theta}=\sum_{i=0}^{n}(x^i + \cos(f))$$
$$ \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$
$$f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi$$
$$\displaystyle \frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}} {1+\frac{e^{-8\pi}} {1+\cdots} } } }$$
$$\displaystyle \left( \sum\_{k=1}^n a\_k b\_k \right)^2 \leq \left( \sum\_{k=1}^n a\_k^2 \right) \left( \sum\_{k=1}^n b\_k^2 \right)$$
$$a^2$$
$$a^{2+2}$$
$$a_2$$
$${x_2}^3$$
$$x_2^3$$
$$10^{10^{8}}$$
$$a_{i,j}$$
$$_nP_k$$
$$c = \pm\sqrt{a^2 + b^2}$$
$$\frac{1}{2}=0.5$$
$$\dfrac{k}{k-1} = 0.5$$
$$\dbinom{n}{k} \binom{n}{k}$$
$$\oint_C x^3\, dx + 4y^2\, dy$$
$$\bigcap_1^n p \bigcup_1^k p$$
$$e^{i \pi} + 1 = 0$$
$$\left ( \frac{1}{2} \right )$$
$$x_{1,2}=\frac{-b\pm\sqrt{\color{Red}b^2-4ac}}{2a}$$
$${\color{Blue}x^2}+{\color{YellowOrange}2x}-{\color{OliveGreen}1}$$
$$\textstyle \sum_{k=1}^N k^2$$
$$\dfrac{ \tfrac{1}{2}[1-(\tfrac{1}{2})^n] }{ 1-\tfrac{1}{2} } = s_n$$
$$\binom{n}{k}$$
$$0+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+\cdots$$
$$\sum_{k=1}^N k^2$$
$$\textstyle \sum_{k=1}^N k^2$$
$$\prod_{i=1}^N x_i$$
$$\textstyle \prod_{i=1}^N x_i$$
$$\coprod_{i=1}^N x_i$$
$$\textstyle \coprod_{i=1}^N x_i$$
$$\int_{1}^{3}\frac{e^3/x}{x^2}\, dx$$
$$\int_C x^3\, dx + 4y^2\, dy$$
$${}_1^2\!\Omega_3^4$$
##### 多行公式 Multi line
> \`\`\`math or \`\`\`latex or \`\`\`katex
$$
f(x) = \int_{-\infty}^\infty
\hat f(\xi)\,e^{2 \pi i \xi x}
\,d\xi
$$
$$
\displaystyle
\left( \sum\_{k=1}^n a\_k b\_k \right)^2
\leq
\left( \sum\_{k=1}^n a\_k^2 \right)
\left( \sum\_{k=1}^n b\_k^2 \right)
$$
$$
\dfrac{
\tfrac{1}{2}[1-(\tfrac{1}{2})^n] }
{ 1-\tfrac{1}{2} } = s_n
$$
$$
\displaystyle
\frac{1}{
\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{
\frac25 \pi}} = 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {
1+\frac{e^{-6\pi}}
{1+\frac{e^{-8\pi}}
{1+\cdots} }
}
}
$$
$$
f(x) = \int_{-\infty}^\infty
\hat f(\xi)\,e^{2 \pi i \xi x}
\,d\xi
$$
1 #include<cstdio> 2 using namespace std; 3 #define ll long long 4 5 int a,b,c; 6 7 int Power(int a,int b,int p){ 8 int ans=1; 9 for(;b;b>>=1,a=(ll)a*a%p) 10 if(b&1)ans=(ll)ans*a%p; 11 return ans; 12 } 13 14 int main(){ 15 scanf("%d%d%d",&a,&b,&c); 16 printf("%d",Power(a,b,c)); 17 return 0; 18 }