sysy-data/h-p/sy/h-1-03.sy

31 lines
397 B
Plaintext
Raw Normal View History

2024-08-08 00:23:26 +08:00
int lim;
int fun(int n,int dep){
if(n==1) return dep;
else{
if(n%2==0) return fun(n/2,dep+1);
else{
if(n*3+1<=lim)
return fun(n*3+1,dep+1);
else
return 0;
}
}
}
const int mod = 1000000007;
int main(){
lim = getint();
int ans = 0;
int i = 1;
starttime();
while(i<=lim){
ans = (ans+fun(i,0))%mod;
i = i+1;
}
stoptime();
putint(ans);
putch(10);
}