Home > Back-end >  All bosses, it is do not to come out,, every brother please guidance
All bosses, it is do not to come out,, every brother please guidance

Time:11-22

CodePudding user response:

Extremely violent, only supplies the reference:
 # include & lt; stdio.h> 
# define MAXLEN 1024

Int handler (int data [], int status [], int n, int len)
{
Int value1, value2, ret, I;

If (n & lt; Len - 1)
{
The status [n]=0;
Ret=handler (data, the status, the n + 1, len);
If (ret) return ret;

The status [n]=1;
Ret=handler (data, the status, the n + 1, len);
If (ret) return ret;
}

The status [n]=0;
Value1=value2=0;
For (I=0; I & lt; Len. I++)
{
If (status==0) [I] value1=value1 + data [I];
The else value2=value2 + data [I];
}
If (value1==value2) return value1.

The status [n]=1;
Value1=value2=0;
For (I=0; I & lt; Len. I++)
{
If (status==0) [I] value1=value1 + data [I];
The else value2=value2 + data [I];
}
If (value1==value2) return value1.

return 0;
}

Int main (void)
{
The int data [MAXLEN], status [MAXLEN];
Int d, ret, len=0;

While (1)
{
The scanf (" % d ", & amp; D);
If (d==1) break;
Data [len++]=d;
}

Ret=handler (data, the status, 0, len);

If (ret & gt; 0) printf (" Yes \ n \ n % d ", ret);
The else printf (" \ n ");

return 0;
}

CodePudding user response:

refer to the second floor ctrigger response:
very violence, only supplies the reference:
 # include & lt; stdio.h> 
# define MAXLEN 1024

Int handler (int data [], int status [], int n, int len)
{
Int value1, value2, ret, I;

If (n & lt; Len - 1)
{
The status [n]=0;
Ret=handler (data, the status, the n + 1, len);
If (ret) return ret;

The status [n]=1;
Ret=handler (data, the status, the n + 1, len);
If (ret) return ret;
}

The status [n]=0;
Value1=value2=0;
For (I=0; I & lt; Len. I++)
{
If (status==0) [I] value1=value1 + data [I];
The else value2=value2 + data [I];
}
If (value1==value2) return value1.

The status [n]=1;
Value1=value2=0;
For (I=0; I & lt; Len. I++)
{
If (status==0) [I] value1=value1 + data [I];
The else value2=value2 + data [I];
}
If (value1==value2) return value1.

return 0;
}

Int main (void)
{
The int data [MAXLEN], status [MAXLEN];
Int d, ret, len=0;

While (1)
{
The scanf (" % d ", & amp; D);
If (d==1) break;
Data [len++]=d;
}

Ret=handler (data, the status, 0, len);

If (ret & gt; 0) printf (" Yes \ n \ n % d ", ret);
The else printf (" \ n ");

return 0;
}

Thank you, thank you

CodePudding user response:

refer to the second floor ctrigger response:
very violence, only supplies the reference:
 # include & lt; stdio.h> 
# define MAXLEN 1024

Int handler (int data [], int status [], int n, int len)
{
Int value1, value2, ret, I;

If (n & lt; Len - 1)
{
The status [n]=0;
Ret=handler (data, the status, the n + 1, len);
If (ret) return ret;

The status [n]=1;
Ret=handler (data, the status, the n + 1, len);
If (ret) return ret;
}

The status [n]=0;
Value1=value2=0;
For (I=0; I & lt; Len. I++)
{
If (status==0) [I] value1=value1 + data [I];
The else value2=value2 + data [I];
}
If (value1==value2) return value1.

The status [n]=1;
Value1=value2=0;
For (I=0; I & lt; Len. I++)
{
If (status==0) [I] value1=value1 + data [I];
The else value2=value2 + data [I];
}
If (value1==value2) return value1.

return 0;
}

Int main (void)
{
The int data [MAXLEN], status [MAXLEN];
Int d, ret, len=0;

While (1)
{
The scanf (" % d ", & amp; D);
If (d==1) break;
Data [len++]=d;
}

Ret=handler (data, the status, 0, len);

If (ret & gt; 0) printf (" Yes \ n \ n % d ", ret);
The else printf (" \ n ");

return 0;
}

Thank you, thank you??
  • Related