这道题让我深深的感到我tm数学到底有多差。。。

做题解前先看一下什么叫手动开根:

https://jingyan.baidu.com/article/4f7d5712f663371a20192797.html

这是手动开根的c++代码实现:

 

#include<cstdio>
#include<cstring>
#include<iostream>

using namespace std;

int l;
int work(int o,char *O,int I)
{
    char c, *D=O ;
    if(o>0)
    {
        for(l=0;D[l];D[l++]-=10)
        {
            D[l++]-=120;
            D[l]-=110;
            while(!work(0,O,l))
                D[l]+=20;
            putchar((D[l]+1032)/20);
        }
        putchar(10);
    }
    else
    {
        c=o+(D[I]+82)%10-(I>l/2)*(D[I-l+I]+72)/10-9;
        D[I]+=I<0 ? 0 : !(o=work(c/10,O,I-1))*((c+999)%10-(D[I]+92)%10);
    }
    return o;
}

int main()
{
    char s[1200];s[0]='0';
    scanf("%s",s+1);
    if(strlen(s)%2 == 1)
        work(2,s+1,0);
    else
        work(2,s,0);
    return 0;
}