#include<bits/stdc++.h>
using namespace std;
int main()
{
int e,f,c;
int test;
cin >>test;
int total,rem,temp;
for(int i=0;i<test;i++)
{
cin>>e>>f>>c;
rem=0;
temp=e+f;
while(temp>=c)
{
total=temp/c;
rem+=total;
temp=total+(temp%c);
}
cout<<rem<<endl;
}
return 0;
}
using namespace std;
int main()
{
int e,f,c;
int test;
cin >>test;
int total,rem,temp;
for(int i=0;i<test;i++)
{
cin>>e>>f>>c;
rem=0;
temp=e+f;
while(temp>=c)
{
total=temp/c;
rem+=total;
temp=total+(temp%c);
}
cout<<rem<<endl;
}
return 0;
}
0 comments :
Post a Comment