Hello, I am a CS student from Taiwan.
I am learing English and Programming.
I'll save source code of some problems or small programs without comments in this blog.
I would recommend you not to read solution from others before you solved the problem.
(這邊專門存放沒有任何註解的小程式/OJ題目程式碼)
2013年8月23日
UVa 11384 - Help is needed for Dexter
#include <stdio.h>
int times(int n) {
if (n == 1) {
return 1;
}
return times(n / 2) + 1;
}
int main() {
int n;
while (scanf("%d", &n) == 1) {
printf("%d\n", times(n));
}
return 0;
}
沒有留言:
張貼留言