In the original "algorithm contest entry classic" seen this problem was thought out selection Baidu. The results Luo Gu once again jumped out. Very embarrassed, I forgot to do I continue to question the method of Baidu. Redo it again, very ashamed
. 1 #include <stdio.h> 2 #include < String .h> . 3 int main ( void ) . 4 { . 5 int A, B; . 6 int SUM = 0 ; . 7 int Ar [ 15 ]; . 8 Memset (Ar, 0 , the sizeof (ar)); // Memset ar array of all the formatted 0 . 9 for ( int n-= 111 ; n-<= 333 ; n-++) // not be repeated before 111, the third number 333 to overflow after 1000 10 { 11 = SUM 0 ; // reset counter 12 is A * = n- 2 ; 13 is B = n-* . 3 ; 14 Ar [n-/ 100 ] Ar = [n-/ 10 % 10 ] = Ar [% n- 10 ] = . 1 ; / / appears in the number of digits in the array is referred to. 1 15 Ar [a / 100 ] Ar = [a / 10 % 10 ] = Ar [% a 10 ] = . 1 ; 16 Ar [B / 100 ] = Ar [ B / 10 % 10] = Ar [% B 10 ] = . 1 ; . 17 for ( int I = . 1 ; I <= . 9 ; I ++ ) 18 is SUM = Ar + [I]; // the array of figures 9 . 19 IF (= SUM = 9 ) // if it is 9, then each number appeared over 20 is the printf ( " % D% D% D \ n- " , n-, A, B); 21 is Memset (Ar, 0 , the sizeof (Ar)) ; // reset the array 22 is } 23 is return 0 ; 24 25 }