测试书写环境
- 代码块:
#include <cstdio>
#include <cstdlib>
int hailstone(int n){
int len = 1;
while(n > 1){
if(n % 2) n = 3 * n + 1; else n /= 2;
len ++;
}
return len;
}
int main(){
int n = 40;
for(int i = 1; i <= n; i ++){
printf("n = %d, len = %d \n", i, hailstone(i));
}
char c = getchar();
return 0;
}
-
图片
感觉良好。完。