#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
long Log2(long arry[] , long n) {
long
i ;
for (i = 0 ; i < CHAR_BIT * sizeof(long) ; i++) {
if ( arry[i] == n)
break ;
else
continue ;
}
return
i ;
}
int main(void) {
const char * str = "abcdefghijklmnopqrstuvwxyz" ;
long
pow2[CHAR_BIT * sizeof(long)] ={0,1} ,i , n
;
unsigned long
mask = 0x1 << CHAR_BIT * sizeof(long) -1 ;
scanf("%ld" , &n) ;
if ( n < 0) {
fprintf(stderr, "integer Overflow") ;
exit(1) ;
}
for(i = 2 ; i < CHAR_BIT * sizeof(long) ; i++)
pow2[i] = pow2[i-1] * 2 ;
while (mask) {
if (mask & n ) {
i = Log2(pow2 , mask) ;
putchar(*str + i - 1 ) ;
}
mask >>= 1 ;
}
return 0 ;
}
[[it] 本帖最后由 iFreeBSD 于 2008-12-11 11:23 编辑 [/it]]