hiho一下第294周《小Hi和小Ho的对弈游戏》题目分析

1 answer(s)

0

include

main() {int a,b,c,d,e,f,g,x; scanf("%d%d",&a,&b); x=0; if(a>b) {c=a;a=b;b=c;} for(d=a;d<=b;d++) {g=d;e=1; while(g!=1) {if(g%2==0) g=g/2; else g=g*3+1; e++ ;} if(e>x) x=e;
} printf("%d %d %d",a,b,x);

return 0; }

write answer 切换为英文 切换为中文


转发分享