Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <limits.h>
- char allow[5][2] = { {'0','0'}, {'1','1'}, {'6','9'}, {'8','8'}, {'9','6'} } ;
- int pass( char *str ) {
- int len = strlen(str);
- int s, e, j ;
- for ( s = 0 , e = len-1 ; s<=e ; s++, e-- ) {
- for ( j = 0 ; j < 5 ; j++ ) {
- if ( str[s] == allow[j][0] && str[e] == allow[j][1] )
- break;
- }
- if ( ! ( j < 5 ) ) return 0 ;
- }
- return 1 ;
- }
- int main() {
- char str[100] ;
- for ( int i = 0 ; i <= INT_MAX ; i++ ) {
- sprintf(str,"%d", i ) ;
- if ( pass(str) )
- printf("%d\n",i) ;
- }
- return 0 ;
- }
Add Comment
Please, Sign In to add comment