uva 550
1 #include<stdio.h> 2 3 int main() 4 { 5 int k , m , n,cnt ,s; 6 while(1) 7 { 8 if(scanf("%d%d%d",&k,&m,&n)!=3)break ; 9 s = m*n ; 10 cnt = 1; 11 while(s != m) 12 { 13 s = s%k*n + s/k ; 14 cnt++; 15 } 16 printf("%d\n",cnt); 17 } 18 return 0 ; 19 }
http://www.cnblogs.com/zrq495/archive/2012/07/31/2617313.html