OJ-Problems-Source/HDOJ/3139_autoAC.cpp

10 lines
187 B
C++
Raw Normal View History

#include<cstdio>
int main(){
int a,e,f,c,b;
while(~scanf("%d%d%d",&e,&f,&c)){
for(a=e+f,b=0;a>=c;a=a%c+a/c)
b+=a/c;
printf("%d\n",b);
}
}