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}_{{}^{x}_{x}x}x}x}_{{}^{{}^{{}^{x}_{x}x}_{{}^{x}_{x}x}x}_{{}^{{}^{x}_{x}x}_{{}^{x}_{x}x}x}x}x}_{{}^{{}^{{}^{{}^{x}_{x}x}_{{}^{x}_{x}x}x}_{{}^{{}^{x}_{x}x}_{{}^{x}_{x}x}x}x}_{{}^{{}^{{}^{x}_{x}x}_{{}^{x}_{x}x}x}_{{}^{{}^{x}_{x}x}_{{}^{x}_{x}x}x}x}x}x}x}x\]

\[\overbrace{\overbrace{\overbrace{\overbrace{\overbrace{x\,x},\overbrace{x\,x}},\overbrace{\overbrace{x\,x},\overbrace{x\,x}}},\overbrace{\overbrace{\overbrace{x\,x},\overbrace{x\,x}},\overbrace{\overbrace{x\,x},\overbrace{x\,x}}}},\overbrace{\overbrace{\overbrace{\overbrace{x\,x},\overbrace{x\,x}},\overbrace{\overbrace{x\,x},\overbrace{x\,x}}},\overbrace{\overbrace{\overbrace{x\,x},\overbrace{x\,x}},\overbrace{\overbrace{x\,x},\overbrace{x\,x}}}}}\]

\[\underbrace{\underbrace{\underbrace{\underbrace{\underbrace{x,x},\underbrace{x,x}},\underbrace{\underbrace{x,x},\underbrace{x,x}}},\underbrace{\underbrace{\underbrace{x,x},\underbrace{x,x}},\underbrace{\underbrace{x,x},\underbrace{x,x}}}},\underbrace{\underbrace{\underbrace{\underbrace{x,x},\underbrace{x,x}},\underbrace{\underbrace{x,x},\underbrace{x,x}}},\underbrace{\underbrace{\underbrace{x,x},\underbrace{x,x}},\underbrace{\underbrace{x,x},\underbrace{x,x}}}}}\]

\[\frac{x}{\frac{x}{\frac{x}{\frac{x}{\frac{x}{x+x}+\frac{x}{x+x}}+\frac{x}{\frac{x}{x+x}+\frac{x}{x+x}}}+\frac{x}{\frac{x}{\frac{x}{x+x}+\frac{x}{x+x}}+\frac{x}{\frac{x}{x+x}+\frac{x}{x+x}}}}+\frac{x}{\frac{x}{\frac{x}{\frac{x}{x+x}+\frac{x}{x+x}}+\frac{x}{\frac{x}{x+x}+\frac{x}{x+x}}}+\frac{x}{\frac{x}{\frac{x}{x+x}+\frac{x}{x+x}}+\frac{x}{\frac{x}{x+x}+\frac{x}{x+x}}}}}\]

\[\frac{\frac{\frac{\frac{\frac{x+x}{x}+\frac{x+x}{x}}{x}+\frac{\frac{x+x}{x}+\frac{x+x}{x}}{x}}{x}+\frac{\frac{\frac{x+x}{x}+\frac{x+x}{x}}{x}+\frac{\frac{x+x}{x}+\frac{x+x}{x}}{x}}{x}}{x}+\frac{\frac{\frac{\frac{x+x}{x}+\frac{x+x}{x}}{x}+\frac{\frac{x+x}{x}+\frac{x+x}{x}}{x}}{x}+\frac{\frac{\frac{x+x}{x}+\frac{x+x}{x}}{x}+\frac{\frac{x+x}{x}+\frac{x+x}{x}}{x}}{x}}{x}}{x}\]

\[\overline{\overline{\overline{\overline{\overline{x,x},\overline{x,x}},\overline{\overline{x,x},\overline{x,x}}},\overline{\overline{\overline{x,x},\overline{x,x}},\overline{\overline{x,x},\overline{x,x}}}},\overline{\overline{\overline{\overline{x,x},\overline{x,x}},\overline{\overline{x,x},\overline{x,x}}},\overline{\overline{\overline{x,x},\overline{x,x}},\overline{\overline{x,x},\overline{x,x}}}}}\]

\[\overline{\overline{\overline{\overline{16\,\,17\,}\,9\,}\,\overline{10\,\,11\,}}\,\overline{\overline{\overline{24\,\,25\,}\,13\,}\,\overline{14\,\,15\,}}}\]

\[\begin{matrix}1\\\overbrace{\begin{matrix}2\\\overbrace{\begin{matrix}4\\\overbrace{\begin{matrix}8\\\overbrace{16\,\,17\,}\end{matrix}\,9\,}\end{matrix}\,\begin{matrix}5\\\overbrace{10\,\,11\,}\end{matrix}}\end{matrix}\,\begin{matrix}3\\\overbrace{\begin{matrix}6\\\overbrace{\begin{matrix}12\\\overbrace{24\,\,25\,}\end{matrix}\,13\,}\end{matrix}\,\begin{matrix}7\\\overbrace{14\,\,15\,}\end{matrix}}\end{matrix}}\end{matrix}\]

\[\frac{1}{\frac{2}{\frac{4}{\frac{8}{16\,\,17\,}\,9\,}\,\frac{5}{10\,\,11\,}}\,\frac{3}{\frac{6}{\frac{12}{24\,\,25\,}\,13\,}\,\frac{7}{14\,\,15\,}}}\]

#include<bits/stdc++.h>
#define LL long long
using namespace std;
template<typename T>void Read(T &cn)
{
    char c;int sig = 1;
    while(!isdigit(c = getchar()))if(c == '-')sig = -1; cn = c-48;
    while(isdigit(c = getchar()))cn = cn*10+c-48; cn*=sig;
}
template<typename T>void Write(T cn)
{
    if(cn < 0) {putchar('-'); cn = 0-cn; }
    int wei = 0; T cm = 0; int cx = cn%10; cn/=10;
    while(cn)cm = cm*10+cn%10,cn/=10,wei++;
    while(wei--)putchar(cm%10+48),cm/=10;
    putchar(cx+48);
}
template<typename T>void Min(T &cn, T cm) {cn = cn > cm ? cm : cn; }
template<typename T>void Max(T &cn, T cm) {cn = cn < cm ? cm : cn; }
int n;
void zuo1(int cn,int l,int r)
{
    if(l == r) {printf("%d\\,",cn); return; }
    int zh = (l+r)>>1;
    printf("\\overline{"); zuo1(cn<<1,l,zh); printf("\\,"); zuo1((cn<<1)|1,zh+1,r); printf("}");
}
void zuo2(int cn,int l,int r)
{
    if(l == r) {printf("%d\\,",cn); return; }
    int zh = (l+r)>>1;
    printf("\\begin{matrix}%d\\\\\\overbrace{",cn); zuo2(cn<<1,l,zh); printf("\\,"); zuo2((cn<<1)|1,zh+1,r); printf("}\\end{matrix}");
}
void zuo3(int cn,int l,int r)
{
    if(l == r) {printf("%d\\,",cn); return; }
    int zh = (l+r)>>1;
    printf("\\frac{%d}{",cn); zuo3(cn<<1,l,zh); printf("\\,"); zuo3((cn<<1)|1,zh+1,r); printf("}");
}
int main()
{
//  freopen(".in","r",stdin);
    freopen("LaTeX.out","w",stdout);
    Read(n); zuo2(1,1,n);
    return 0;
}
上一篇:【故障公告】阿里云 RDS 实例 CPU 100% 故障引发全站无法正常访问


下一篇:2的幂