[Cpp]
# Include <stdio. h>
# Include <stdlib. h>
# Include <string. h>
/*************************************** **************************************** **************************************** *************************************
****
* ** Begin: 2012 10 12
* *** Number of replies
* *** Find the minimum number of input files greater than a single number
* *** End: 2012 10 12
****
**************************************** **************************************** **************************************** ************************************/
Void main (){
Char data [10] = {0}, res [10] = {0}, state [10] = {0}, len = 0, pos, bit = 0;
Scanf ("% s", data );
Len = strlen (data );
If (len % 2 = 0) {// even
Pos = len/2-1;
}
Else {
Pos = len/2;
}
While (pos-bit> = 0 ){
If (len % 2 = 1 ){
If (data [pos-bit]> = data [pos + bit]) {
Res [pos-bit] = data [pos-bit];
Res [pos + bit] = data [pos-bit];
}
Else {
Data [pos-bit + 1] ++;
Memset (& data [pos-bit + 2], '0', len-(pos-bit + 1 ));
Bit = 0;
Continue;
}
Bit ++;
}
Else {
If (data [pos-bit]> = data [pos + 1 + bit]) {
Res [pos-bit] = data [pos-bit];
Res [pos + 1 + bit] = data [pos-bit];
}
Else {
Data [pos-bit] ++;
Memset (& data [pos-bit + 1], '0', len-(pos-bit + 1) + 1 );
Bit = 0;
Continue;
}
Bit ++;
}
}
Printf ("the number of replies is % s", res );
}