[DFS] Mystery series

这里写图片描述 这里写图片描述

#include<cstdio>
int a[101][101]; 
int total=0,n,m;

void input()//Read in{scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++) scanf("%d",&a[n+1][i]);
}

void dfs(int dep)
{
    if (dep==1)//If there is only one number{if (a[2][1]==m) total++;//Program number plus one 
        return;// Exit| ||}
    }
    for (int i=1;i<=dep-1;i++)
    {
        for (int j=1;j<=i-1;j++)
         a[dep][j]=a[dep+1][j];//i before the series pushed forwarda[dep][i]=(a[dep+1][i]-a[dep+1][i+1]);// subtracted 
        for (int j=i+2;j<=dep+1;j++)
         a[dep][j-1]=a[dep+1][j];//i after the series前推dfs(dep-1);
    }
} 

int main()
{
    input();//Read indfs(n);//深搜
    printf("%d",total);//Output plan number
    return 0;
}