You are viewing a single comment's thread. Return to all comments →
int main() { int t,i; scanf("%d",&t); for(i=1;i<=t;i++) { int n,c,m,ans,x,sum=0; scanf("%d %d %d",&n,&c,&m); ans=n/c; x=ans; while(x>=m) { sum=sum+(x/m); x=(x/m)+(x%m);
} printf("%d\n",ans+sum); } return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Chocolate Feast
You are viewing a single comment's thread. Return to all comments →
include
include
include
include
include
include
include
int main() { int t,i; scanf("%d",&t); for(i=1;i<=t;i++) { int n,c,m,ans,x,sum=0; scanf("%d %d %d",&n,&c,&m); ans=n/c; x=ans; while(x>=m) { sum=sum+(x/m); x=(x/m)+(x%m);
}