#include <iostream>
using namespace std;
int main() {
int k, factor, num_1, num_0;
while (cin>> k >> num_0 >> factor) {
int count = 1;
num_1 = num_0 * factor;
while (num_1 != num_0) {
count++;
num_1 = num_1 % k * factor + num_1 / k;
}
cout<< count<< endl;
}
return 0;
}
UVA 550 (暑假-数论 -B - Multiplying by Rotation)
最新推荐文章于 2016-08-11 14:06:47 发布