#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
int bit, m, n;
while(cin>>bit>>m>>n)
{
int a, b = m, c = 0, d = 0, count = 0;
while(1)
{
d = b*n + d/bit;
a = d % bit;
if(d!=m){count++;}
else break;
b = a;
}
cout<<count+1<<endl;
}
return 0;
}
UVA550-移位乘法
最新推荐文章于 2022-02-25 19:38:17 发布