} //回溯,判断另一种符号情况 for(j=2; j<=t; ++j) {
counter -= p[j][t-j+1]; }
counter -= i; } } }
int main() {
cout << "请输入第一行符号个数n:"; cin >> n; counter = 0; sum = 0;
half = n*(n+1)/2; int i=0;
if( half%2 == 0 )
{//总数须为偶数,若为奇数则无解 half /= 2;
p = new uchar *[n+1];
for(i=0; i<=n; ++i)
{
p[i] = new uchar[n+1];
memset(p[i], 0, sizeof(uchar)*(n+1)); }
Backtrace(1); for(i=0; i<=n; ++i) {
delete[] p[i]; }
delete[] p; }
cout << "\n总共 " << sum << " 个"<< endl; return 0; }