#include <stdio.h>
int soda(int x,int n){
if(x==n){
return 1;
}
if(x<n){
return 0;
}
return x/n+soda(x/n+x%n,n);
}
int main()
{
int cases,e,f,c,i;
scanf("%d",&cases);
for(i=1;i<=cases;i++){
scanf("%d %d %d",&e,&f,&c);
printf("%d\n",soda(e+f,c));
}
return 0;
}
int soda(int x,int n){
if(x==n){
return 1;
}
if(x<n){
return 0;
}
return x/n+soda(x/n+x%n,n);
}
int main()
{
int cases,e,f,c,i;
scanf("%d",&cases);
for(i=1;i<=cases;i++){
scanf("%d %d %d",&e,&f,&c);
printf("%d\n",soda(e+f,c));
}
return 0;
}
No comments:
Post a Comment