追踪1号队员,取他回到原来位置需要的次数
#include<stdio.h> int main(){ int T,t,n,ans,x; scanf("%d",&T); for(t=1;t<=T;t++){ scanf("%d",&n); ans=x=1; while(x!=n+1){ if(x>n) x=(x-n)*2-1; else x*=2; ans++; } printf("Case #%d: %d ",t,ans); } return 0; }