桃子猴.c
上传用户:hcsoft898
上传日期:2022-07-20
资源大小:2k
文件大小:0k
源码类别:

数学计算

开发平台:

Visual C++

  1. #include <stdio.h> 
  2. #include <stdlib.h> 
  3. void main() 
  4. int total = 0; 
  5. int n,b;
  6. scanf("%d%d",&n,&b);
  7. while(1) 
  8. int i = ++total; 
  9. int j; 
  10. for(j = 0; j< n;j++, i = (i-b)*(n-1)/n) 
  11.   if((i - b) % n == 0) 
  12.       continue; 
  13.   else 
  14.       break; 
  15.  } 
  16.  if ( j == n ) 
  17.      break; 
  18. printf("The result is %d", total);