因为痛,所以叫青春

我有一个梦想:穷屌丝变身富屌丝
UVa 550 - Multiplying by Rotation

这题到底是啥意思啊?》线性同余也不是,好像不是数论里面的内容啊,怎么都看不懂它是在搞什么东西的

看了别人的题解,写的代码

View Code
#include<iostream>
using namespace std;
int main()
{
    int k, m, n;
    while(cin >> k >> m >> n)
    {
        int cnt=1;
        int s=m*n;
        while(s != m)
        {
            s=s%k*n+s/k;
            cnt++;
        }
        cout << cnt << endl;
    }
    return 0;
}

posted on 2012-08-01 15:40  Nice!  阅读(166)  评论(0编辑  收藏  举报