#include<iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
int n,c,m,w,total;
cin>>n>>c>>m;
total=n/c;
w=total;
while(w>=m)
{
total=total+w/m;
w=w/m+w%m;
//w+=w/m;
}
cout<<total<<endl;
}
return 0;
}
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
int n,c,m,w,total;
cin>>n>>c>>m;
total=n/c;
w=total;
while(w>=m)
{
total=total+w/m;
w=w/m+w%m;
//w+=w/m;
}
cout<<total<<endl;
}
return 0;
}
No comments:
Post a Comment