OJ-Problems-Source/HDOJ/3139_autoAC.cpp
2016-09-01 20:51:58 +08:00

10 lines
187 B
C++

#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);
}
}