UVa Problem 10127 Ones (仅由 1 组成的数)

来源:互联网 发布:车牌识别软件 编辑:程序博客网 时间:2024/04/30 05:55
// Ones (仅由 1 组成的数)// PC/UVa IDs: 110504/10127, Popularity: A, Success rate: high Level: 2// Verdict: Accepted// Submission Date: 2011-05-29// UVa Run Time: 0.008s//// 版权所有(C)2011,邱秋。metaphysis # yeah dot net//// 利用求模运算。(x * y + 1) mod n = ((x mod n) * (y mod n) + (1 mod n)) mod n。#include <iostream>using namespace std;int main(int ac, char *av[]){int number;while (cin >> number){long long start = 1;int counter = 1;while (start % number){start = (start % number) * (10 % number) + 1;counter++;}cout << counter << endl;}return 0;}