Home > Back-end >  Everybody, help to see it
Everybody, help to see it

Time:02-22

C

Thank you thank you

CodePudding user response:

1

 # include & lt; Stdio. H> 
Int isprime (int n)
{
int i;
If (n & lt; 2)
return 0;
For (I=2; I & lt; n; I++)
{
If (n % 2==0)
{
return 0;
}
}
return 1;
}

Int resolve (int n)
{
int i;
For (I=2; I & lt; n; I++)
{
If (isprime (I) & amp; & Isprime (n - I))
{
return i;
}
}
return 0;
}

Int main (void)
{
Int n, m;
int res;
The scanf (" % d % d ", & amp; N, & amp; M);
For (int I=n; I & lt;=m; I++)
{
Res=resolve (I);
If (res!=0)
{
Printf (" % d=% d + % d \ n ", I, res, I - res);
}
}
return 0;
}

CodePudding user response:

The second question
 # include & lt; Stdio. H> 
Int judge (int a [], int n, int * CD)
{
If (n & lt; 3)
return -1;
Int I, j, TMP.
For (I=0; I & lt; n; I++)
{
For (j=I + 1; J & lt; n; J++)
{
If (a [I] & gt; A [j])
{
TMP=a, [I].
A [I]=a, [j].
A [j]=TMP;
}
}
}
* CD=a, [1], a [0].
For (I=0; I & lt; N - 1; I++)
{
If (* CD!=(a [I + 1] - [I] a))
{
* CD=0;
return 1;
}
}
return 0;
}

Int main (void)
{
Int a [50]={0};
Int n, CD;
The scanf (" % d ", & amp; N);
for (int i=0; I & lt; n; I++)
{
The scanf (" % d ", & amp; A [I]);
}
If (judge (a, n, & amp; CD)==0)
{
Printf (" % d ", CD);
}
return 0;
}

CodePudding user response:

The third topic

 # include & lt; Stdio. H> 

Num int CheckPhoneNum (char *)
{
Char * p=num.
Int len=0;
While (* (p++)!='\ 0')
{
Len++;
}
For (int I=len - 1; I & gt; Len - 5; I -)
{
If (num [I] & gt;='0' & amp; & Num [I] <='9')
{
continue;
}
The else
{
return 1;
}
}
If (num [len - 5]!='-')
{
Printf (" num [% d] is not - \ n ", len - 5).
return 1;
}
For (int I=len - 6; I & gt; Len - 9; I -)
{
If (num [I] & gt;='0' & amp; & Num [I] <='9')
{
continue;
}
The else
{
Printf (" prefix num] [% d % d is not number \ n ", I, num [I]);
return 1;
}
}
If (num [len - 8]=='0')
{
Printf (" num [% d] is not - \ n ", len - 5).
return 1;
}
int sum=0;
for (int i=0; I & lt; Len - 9; I++)
{
The sum + num=[I] - '0';
}
If (sum==0)
{
If (num [len - 9]=='-')
{
Printf (" num [% d] is - \ n ", len - 9);
return 1;
}
}
The else
{
If (num [len - 9]!='-')
{
Printf (" num [% d] is not - \ n ", len - 5).
return 1;
}
}
return 0;
}

Int main (void)
{
Char num [15].
The scanf (" % s ", num);
If (CheckPhoneNum (num)==0)
{
Printf (" % s \ n "provisions, num);
}
The else
{
Printf (" % s is not in conformity with the provisions \ n ", num);
}

return 0;
}

CodePudding user response:

Thank you, thank you