-
Notifications
You must be signed in to change notification settings - Fork 0
/
C.cpp
55 lines (50 loc) · 1.17 KB
/
C.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
const int MAX = 150007;
const int MOD = 1000000007;
long long binpow(long long a, long long b, long long m) {
a %= m;
long long res = 1;
while (b > 0) {
if (b & 1)
res = res * a % m;
a = a * a % m;
b >>= 1;
}
return res;
}
void solve() {
long long n;
cin >> n;
long long curr = 0;
for (long long i = 0; i < 1000000; i++) {
curr = ((curr * 10) % n + 7) % n;
if (curr % n == 0) {cout << i + 1; return;}
}
cout << -1;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
//freopen("rental.in", "r", stdin); freopen("rental.out", "w", stdout);
//int tt; cin >> tt; for (int i = 1; i <= tt; i++) {solve(); cout << endl;}
solve();
}