A non-negative integer N, if each number from left to right is symmetrical, is a palindrome,
Input format:
A number of nonnegative integer or carriage return delimited by Spaces, every integer represents a set of data,
The output format:
Each group of data of a monopoly on line, if it is a palindrome, output: YES, otherwise output: NO,
Input the sample:
123
12321
404
506
The output sample:
NO
YES
YES
NO
CodePudding user response:
OJ practices is provided by test input file, so end of file is input end,In addition, the output line at the end of the lack of \ n could not really output immediately, can also lead to overtime,
CodePudding user response:
Have which give the codeCodePudding user response:
Use CTRL + z input end, for reference:# include & lt; Stdio. H>
Int main (int arg c, char * argv [])
{
Char STR [100] [20].
Char * p * q;
Int flag, I=0, CNT;
While ((CNT=the scanf (" % s ", STR [I]))!=(EOF) i++;//Ctrl + z input end of the
for(int j=0; JFlag=1;
P=STR [j];
Q=STR [j];
While (* q!='\ 0')
Q++;
Q -;
While (pIf ((* p!=* q))
{
Flag=0;
break;
}
p++;
Q -;
}
If (flag==1)
Printf (" Yes \ n ");
The else
Printf (" \ n ");
}
return 0;
}
CodePudding user response:
1 digit calculating do not calculate palindrome?Two same double-digit count palindrome?
How many people are input the longest?
With the beginning of 0?
.
CodePudding user response:
C language can be used while (~ the scanf (" % d ", & amp; To enter a)), c + + can be used while (cin> A) and then inside the while loop in the analysis of the input numberCodePudding user response: