题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=4823
题意:中文题,很清楚,要注意的是乘起来会爆int
题解:
#include<cstdio>
int main(){
long long t,n,m,v,k,ans,pre;
scanf("%d",&t);
while(t--){
scanf("%I64d%I64d%I64d%I64d",&n,&m,&v,&k);
if(m>=n)printf("0\n");
else{
ans=,pre=-;
while(m<n&&m>=v&&pre!=m){pre=m,m=(m-v)*k,ans++;}
if(m>=n)printf("%I64d\n",ans);
else printf("-1\n");
}
}
return ;
}