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

posted @ 2013-12-06 21:08  shaughn  阅读(75)  评论(0编辑  收藏  举报