记:
进制转换
AC代码:
1 #include <stdio.h> 2 #define K 2 3 4 int main(void) 5 { 6 int n,ans = 0; 7 scanf("%d",&n); 8 while (1) 9 { 10 if (n/K ==0 && n%K == 0) 11 { 12 break; 13 } 14 n = n/K; 15 ans ++; 16 } 17 printf("%d",ans); 18 return 0; 19 }