buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <bits/stdc++.h> using namespace std; #define FOR(i, o, n) for (long long i = o; i < n; i++) #define oneforall \ ios::sync_with_stdio(false); \ cin.tie(0); #define all(v) (v).begin(), (v).end() #defi...
#include <bits/stdc++.h> using namespace std; #define FOR(i, o, n) for (long long i = o; i < n; i++) #define oneforall \ ios::sync_with_stdio(false); \ cin.tie(0); #define all(v) (v).begin(), (v).end() #defi...
[["+", 8, 9, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 17, 132], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 14, 8, 9, 0, 9, 0, 1, 0, 35]]
1
299
def gcd(a, b): if a < b: return gcd(b, a) if b == 0: return a return gcd(b, a%b) K = int(input()) if gcd(K, 10) != 1: print(-1) else: if K % 7 == 0: K/=7 ans = 1 cur = 1 while cur % K != 0: cur += pow(10, ans, K) ans += 1 print(ans)
def gcd(a, b): if a < b: return gcd(b, a) if b == 0: return a return gcd(b, a%b) K = int(input()) if gcd(K, 10) != 1: print(-1) else: if K % 7 == 0: K//=7 ans = 1 cur = 1 while cur % K != 0: cur += pow(10, ans, K) ans += 1 print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 17, 90], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 691]]
5
101
K = int(input()) if K == 7: print(1) else: if K % 7 == 0: K //= 7 r = 1 for i in range(1,K+1): if r == 0: print(i) break r += pow(10,i,K) #print(r) r %= K else: print(-1)
K = int(input()) if K == 7 or K == 1: print(1) else: if K % 7 == 0: K //= 7 r = 1 for i in range(1,K+1): if r == 0: print(i) break r += pow(10,i,K) #print(r) r %= K else: print(-1)
[["+", 36, 36, 0, 656, 0, 57, 15, 679, 17, 354], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 667, 60], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 612]]
5
75
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define all(v) v.begin(), v.end() #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define Rep(n) for (ll _ = 0; _ < (ll)(n); _++) template <class S> S sum(vector<S> &a) { return accumulate(all(a), S()); } template <class S> ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define all(v) v.begin(), v.end() #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define Rep(n) for (ll _ = 0; _ < (ll)(n); _++) template <class S> S sum(vector<S> &a) { return accumulate(all(a), S()); } template <class S> ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
420
#include <algorithm> #include <iomanip> // std::setprecision() #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; using ll = long long; #define rep(i, a, b) for (ll i = (a); i < (b); i++) #define YES cout << "...
#include <algorithm> #include <iomanip> // std::setprecision() #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; using ll = long long; #define rep(i, a, b) for (ll i = (a); i < (b); i++) #define YES cout << "...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
212
#include <iostream> #include <set> using namespace std; int main() { int K; cin >> K; int x = K % 7; set<int> s; int i = 1; while (s.count(x) == 0) { if (x == 0) { cout << i << endl; return 0; } s.insert(x); x = (x * 10 + 7) % K; i++; } cout << -1 << endl; return 0; ...
#include <iostream> #include <set> using namespace std; int main() { int K; cin >> K; int x = 7 % K; set<int> s; int i = 1; while (s.count(x) == 0) { if (x == 0) { cout << i << endl; return 0; } s.insert(x); x = (x * 10 + 7) % K; i++; } cout << -1 << endl; return 0; ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
100
K=int(input()) num=7 count = 0 checkK = [0 for j in range(K)] result = "" flag = True while(flag): count += 1 if num==0: flag = False result = str(count) num = (num*10+7)%K checkK[num] += 1 if checkK[num] == 2: flag = False result = "-1" print(result)
K=int(input()) num=7 count = 0 checkK = [0 for j in range(K)] result = "" flag = True while(flag): count += 1 if num%K==0: flag = False result = str(count) num = (num*10+7)%K checkK[num] += 1 if checkK[num] == 2: flag = False result = "-1" print(result)
[["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 109], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 22]]
5
92
K = int(input()) n = 0 for i in range(1, K): n = (n*10 + 7) % K if n == 0: print(i) exit() else: print(-1)
K = int(input()) n = 0 for i in range(1, 1000000): n = (n*10 + 7) % K if n == 0: print(i) exit() else: print(-1)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
51
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll k; cin >> k; ll c = 0; for (ll i = 0; i < k; i++) { c = (c * 10 + 7) % k; if (c % k == 0) { cout << i << "\n"; return 0; } } cout << -1 << "\n"; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll k; cin >> k; ll c = 0; for (ll i = 1; i <= k; i++) { c = (c * 10 + 7) % k; if (c % k == 0) { cout << i << "\n"; return 0; } } cout << -1 << "\n"; }
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
86
import math k=int(input()) if k%7==0:k/=7 if math.gcd(10,k)!=1: exit(print(-1)) if k==1: exit(print(1)) v=1 ans=0 while(v!=0): v=(v*10+1)%k ans+=1 print(ans+1)
import math k=int(input()) if k%7==0:k//=7 if math.gcd(10,k)!=1: exit(print(-1)) if k==1: exit(print(1)) v=1 ans=0 while(v!=0): v=(v*10+1)%k ans+=1 print(ans+1)
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 17, 90], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 691]]
5
85
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; ++i) #define endl "\n" typedef long long ll; const long long INF = 1e9; int ci; int main() { int k; int n = 1e7 + 1; cin >> k; if (k % 7 == 0) k /= 7; if (k == 1) { cout << 1 << endl; return 0; } int ans = ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; ++i) #define endl "\n" typedef long long ll; const long long INF = 1e9; int ci; int main() { int k; int n = 1e7 + 1; cin >> k; if (k % 7 == 0) k /= 7; if (k == 1) { cout << 1 << endl; return 0; } int ans = ...
[["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 31, 13], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 17, 48], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 25]]
1
156
#include <bits/stdc++.h> //#define long long ll ; #define mod 1e+9; #define rep \ for (int i = 0; i < n; i++) \ ; #define pb push_back; #define popb pop_back; using namespace std; const int ma = 1e6...
#include <bits/stdc++.h> //#define long long ll ; #define mod 1e+9; #define rep \ for (int i = 0; i < n; i++) \ ; #define pb push_back; #define popb pop_back; using namespace std; const int ma = 1e6...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
149
import sys K = int(input()) power = 1 SUM = 0 for i in range(1, 10 ** 6): SUM += power if SUM % K == 0: print(i) sys.exit() power *= 10 power %= K print(-1)
import sys K = int(input()) power = 7 SUM = 0 for i in range(1, 10 ** 6): SUM += power if SUM % K == 0: print(i) sys.exit() power *= 10 power %= K print(-1)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
58
// // Created on 2020/08/02. // #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #includ...
// // Created on 2020/08/02. // #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #includ...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
244
K=int(input()) a=7 count=1 for i in range(K): if a==0: print(count) break a=(a*10+7)%K count+=1 if count==K+1: print(-1)
K=int(input()) a=7 count=1 for i in range(K): if a%K==0: print(count) break a=(a*10+7)%K count+=1 if count==K+1: print(-1)
[["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 109], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 22]]
5
58
# AtCoder Beginner Contest 174 # C - Repsept K=int(input()) modsevens=[7] if K==7 or 1: print(1) exit() for i in range (1,K+2): a=(modsevens[-1] *10+7)%K if a==0: print(i+1) exit() else: modsevens.append(a) print(-1)
# AtCoder Beginner Contest 174 # C - Repsept K=int(input()) modsevens=[7] if K==7 or K==1: print(1) exit() else: pass for i in range (1,K+2): a=(modsevens[-1] *10+7)%K if a==0: print(i+1) exit() else: modsevens.append(a) print(-1)
[["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 667, 60], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102], ["+", 0, 57, 75, 76, 8, 196, 0, 674, 0, 675]]
5
83
#include <bits/stdc++.h> using namespace std; int main() { int n; if (n % 2 == 0 || n % 5 == 0) cout << -1; else { long long count = 1; long long a = 7; while (1) { if (a % n == 0) { cout << count; break; } count++; a = (a * 10 + 7) % n; } } return 0...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n % 2 == 0 || n % 5 == 0) cout << -1; else { long long count = 1; long long a = 7; while (1) { if (a % n == 0) { cout << count; break; } count++; a = (a * 10 + 7) % n; } ...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
88
K = int(input()) tmpNum = 7 count = 1 keisuu = 10 tmp = tmpNum%K aa = tmp while tmp !=0 and count<=K: aa = (aa*10)%K tmp = (tmp+aa)%K count+=1 if count==K: count=-1 print(count)
K = int(input()) tmpNum = 7 count = 1 keisuu = 10 tmp = tmpNum%K aa = tmp while tmp !=0 and count<=K: aa = (aa*10)%K tmp = (tmp+aa)%K count+=1 if count>K: count=-1 print(count)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47]]
5
68
N=int(input()) x=7%N for i in range(1,N): if x==0: print(i) exit() x=(x*10+7)%N print(-1)
N=int(input()) x=7%N for i in range(1,N+1): if x==0: print(i) exit() x=(x*10+7)%N print(-1)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
51
k = int(input()) if k % 2 == 0: print(-1) elif k % 5 == 0: print(-1) elif k%7 == 0: l = 9*k/7 form = 1 for i in range(l): if form * 10 % l == 1: print(i+1) break else: form = form * 10 % l else: l = 9 * k form = 1 for i in range(l): if form * 10 % l == 1: print(i+1) break else: form =...
k = int(input()) if k % 2 == 0: print(-1) elif k % 5 == 0: print(-1) elif k%7 == 0: l = 9*k//7 form = 1 for i in range(l): if form * 10 % l == 1: print(i+1) break else: form = form * 10 % l else: l = 9 * k form = 1 for i in range(l): if form * 10 % l == 1: print(i+1) break else: form ...
[["-", 64, 196, 0, 1, 0, 662, 12, 657, 17, 85], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 676]]
5
125
cnt = 1 mod = 7 k = int(input()) for i in range(k): if mod % k == 0: break cnt += 1 mod = (mod * 10 * 7) % k if mod % k == 0: print(cnt) else: print(-1)
cnt = 1 mod = 7 k = int(input()) for i in range(k): if mod % k == 0: break cnt += 1 mod = (mod * 10 + 7) % k if mod % k == 0: print(cnt) else: print(-1)
[["-", 0, 662, 12, 657, 31, 23, 0, 657, 17, 48], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 17, 72]]
5
62
#include <bits/stdc++.h> using namespace std; using ll = long long; using vl = vector<ll>; using vi = vector<int>; #define _GLIBCXX_DEBUG #define IO_STREAM \ cin.tie(0); \ ios::sync_with_std...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vl = vector<ll>; using vi = vector<int>; #define _GLIBCXX_DEBUG #define IO_STREAM \ cin.tie(0); \ ios::sync_with_std...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13]]
1
167
#include <iostream> using namespace std; int main() { long long K, p = 0, c = 0; cin >> K; if (K % 2 == 0 || K % 5 == 0) cout << "-1"; else { do { p = (p * 10 + 7) % K; ++c; } while (p); } cout << c; return 0; }
#include <iostream> using namespace std; int main() { long long K, p = 0, c = 0; cin >> K; if (K % 2 == 0 || K % 5 == 0) cout << "-1"; else { do { p = (p * 10 + 7) % K; ++c; } while (p); cout << c; } return 0; }
[["-", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
81
#include <bits/stdc++.h> #define ll long long #define pb push_back #define ff first #define ss second #define mp make_pair #define scan(a) scanf("%d", &a) #define scanl(a) scanf("%lld", &a) #define scand(a) scanf("%lf", &a) #define scan2(a, b) scanf("%d %d", &a, &b) #define scanl2(a, b) scanf("%lld %lld", &a, &b) #de...
#include <bits/stdc++.h> #define ll long long #define pb push_back #define ff first #define ss second #define mp make_pair #define scan(a) scanf("%d", &a) #define scanl(a) scanf("%lld", &a) #define scand(a) scanf("%lf", &a) #define scan2(a, b) scanf("%d %d", &a, &b) #define scanl2(a, b) scanf("%lld %lld", &a, &b) #de...
[["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
225
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; int main(void) { ll K; cin >> K; ll ans = 1; if (K % 2 == 0) { cout << -1 << endl; return 0; } else { int x = 7 % K; for (int i = 0; i < K; i++) { if (x == 0) { co...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; int main(void) { ll K; cin >> K; ll ans = 1; if (K % 2 == 0) { cout << -1 << endl; return 0; } else { int x = 7 % K; for (int i = 0; i < K; i++) { if (x == 0) { co...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
127
n = gets.to_i if n % 2 == 0 || n % 5 == 0 puts -1 return end n = n / 7 if n % 7 == 0 x = 0 count = 0 n.times do x = (x * 10 + 7) % n count += 1 break if x == 0 end puts x == 0 ? count : -1
n = gets.to_i if n % 2 == 0 || n % 5 == 0 puts -1 return end n = n / 7 if n % 7 == 0 x = 0 count = 0 n.times do x = (x * 10 + 1) % n count += 1 break if x == 0 end puts x == 0 ? count : -1
[["-", 0, 662, 12, 738, 31, 739, 0, 738, 12, 612], ["+", 0, 662, 12, 738, 31, 739, 0, 738, 12, 612]]
4
72
#include <bits/stdc++.h> using namespace std; #define int long long #define FASTIO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.ti...
#include <bits/stdc++.h> using namespace std; #define int long long #define FASTIO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.ti...
[["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 35], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
200
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define rep(i, m, n) for (int i = m; i < n; i++) const ll mod = 1e9 + 7; int main() { int k; cin >> k; ll cur = 0; ll s = 7; int i = 1; while (i < k) { cur += s; cur %= k; s *= 10; s %= k; if (...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define rep(i, m, n) for (int i = m; i < n; i++) const ll mod = 1e9 + 7; int main() { int k; cin >> k; ll cur = 0; ll s = 7; int i = 1; while (i <= k) { cur += s; cur %= k; s *= 10; s %= k; if ...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
122
#include <algorithm> #include <iostream> using namespace std; typedef long long ll; const int cnt = 1e5 + 7; int main() { // freopen("input.txt","r",stdin);//设置 cin scanf 这些输入流都从 //test.in中读取 int k; cin >> k; bool flag = 0; //是否满足条件,满足条件为1 ll sum = 0; int ans; for (int i = 0; i < cnt; i++) { sum...
#include <algorithm> #include <iostream> using namespace std; typedef long long ll; const int cnt = 1e6 + 7; int main() { // freopen("input.txt","r",stdin);//设置 cin scanf 这些输入流都从 //test.in中读取 int k; cin >> k; bool flag = 0; //是否满足条件,满足条件为1 ll sum = 0; int ans; for (int i = 0; i < cnt; i++) { sum...
[["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13]]
1
118
k = int(input()) t = 7 for i in range(1, k+1): if t == 0: print(i) break t = (t*10+7) % k else: print(-1)
k = int(input()) x = 7 % k for i in range(1, k+1): if x == 0: print(i) break x = (x*10+7) % k else: print(-1)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+",...
5
51
#include <iostream> using namespace std; typedef long long ll; ll rsept(ll k) { ll value = 7; if (k % 2 == 0 || k % 5 == 0) return -1; for (ll i = 1; i < 1e7; i++) { if (value % k == 0) { return i; } else value = (value * 10 + 7); } return -1; } int main() { ll k; cin >> k; cout ...
#include <iostream> using namespace std; typedef long long ll; ll rsept(int k) { ll value = 7; if (k % 2 == 0 || k % 5 == 0) return -1; for (ll i = 1; i < 1e9; i++) { if (value % k == 0) { return i; } else value = (value * 10 % k + 7 % k); } return -1; } int main() { ll k; cin >> k...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 11, 12, 23, 0, 16, 31, 16, 17, 109], ["+", 0, 11, 12, 23, 0, 16, 31, 16, 12, 22], ["+", 0, 11, 12, 23, 0, 16, 12, 16, 17, 109], ["+", 0,...
1
109
k = int(input()) x = 7 ans = 1 for i in range(k): if x == 0: print(ans) exit() ans += 1 x = (x * 10 + 7) % k print(-1)
k = int(input()) x = 7 % k ans = 1 for i in range(k): if x == 0: print(ans) exit() ans += 1 x = (x * 10 + 7) % k print(-1)
[["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22]]
5
53
k=int(input()) s={7} a=7 n=1 flag=True while not {0}<=s: a=(a*10+7)%k beforelen=len(s) s.add(a) if len(s)==beforelen: flag=False break n+=1 print(n if flag else -1)
k=int(input()) s={7%k} a=7%k n=1 flag=True while not {0}<=s: a=(a*10+7)%k beforelen=len(s) s.add(a) if len(s)==beforelen: flag=False break n+=1 print(n if flag else -1)
[["+", 0, 1, 0, 662, 12, 282, 0, 657, 17, 109], ["+", 0, 1, 0, 662, 12, 282, 0, 657, 12, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22]]
5
77
K = int(input()) N = 10 a = 0 l = 9*K if(K==7): a+=1 print(1) else: for i in range(1,10**6): N = (10*N)%l if (N*7-7)%l==0: print(i+1) a +=1 break if(a == 0): print(-1)
K = int(input()) N = 10 a = 0 l = 9*K if(K==7 or K==1): a+=1 print(1) else: for i in range(1,10**6): N = (10*N)%l if (N*7-7)%l==0: print(i+1) a +=1 break if(a == 0): print(-1)
[["+", 0, 656, 0, 57, 15, 23, 0, 679, 17, 354], ["+", 0, 57, 15, 23, 0, 679, 12, 666, 0, 22], ["+", 0, 57, 15, 23, 0, 679, 12, 666, 667, 60], ["+", 0, 57, 15, 23, 0, 679, 12, 666, 0, 612]]
5
91
#include <bits/stdc++.h> using namespace std; using ll = long long; const char NL = '\n'; const int MOD = 1e9 + 7; void solve() { int k; cin >> k; for (int n = 0, i = 1; i <= k; ++i) { n = (n * 10 + 7) % k; if (n % k == 0) { cout << i << NL; } } cout << -1 << NL; } int main() { ios::syn...
#include <bits/stdc++.h> using namespace std; using ll = long long; const char NL = '\n'; const int MOD = 1e9 + 7; void solve() { int k; cin >> k; for (int n = 0, i = 1; i <= k; ++i) { n = (n * 10 + 7) % k; if (n % k == 0) { cout << i << NL; return; } } cout << -1 << NL; } int main(...
[["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 35]]
1
122
k=int(input()) flag=True seq=7 """ これは階乗を含むのでO(klogk)で重い for i in range(1,k): if (7*(10**i-1)//9) % k==0: print(i) flag=False break """ for i in range(1,k): if seq%k==0: print(i) flag=False break seq=(seq*10+7)%k # %k(modの考え方)がなければ10**6ではO(k)は重すぎた if flag: print(-1)
k=int(input()) flag=True seq=7 """ これは階乗を含むのでO(klogk)で重い for i in range(1,k+1): if (7*(10**i-1)//9) % k==0: print(i) flag=False break """ for i in range(1,k+1): if seq%k==0: print(i) flag=False break seq=(seq*10+7)%k # %k(modの考え方)がなければ10**6ではO(k)は重すぎた if flag: print(-1)
[["-", 36, 36, 0, 656, 0, 1, 0, 557, 0, 6], ["+", 36, 36, 0, 656, 0, 1, 0, 557, 0, 6], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
62
#include <algorithm> #include <bitset> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <set> #include <stdlib.h> #include <string> #include <utility> #include <vector> using namespace std; typedef long long int ll; typedef long double ld; typedef pai...
#include <algorithm> #include <bitset> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <set> #include <stdlib.h> #include <string> #include <utility> #include <vector> using namespace std; typedef long long int ll; typedef long double ld; typedef pai...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 67], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109]]
1
330
K = int(input()) i = 0 ret = -1 if K % 5 != 0 and K % 2 != 0: N = 1 if K % 7 == 0: L = K * 9 // 7 else: L = K * 9 while True: if N % L == 1: ret = i break N = (N * 10 )% L i += 1 print(ret)
K = int(input()) i = 1 ret = -1 if K % 5 != 0 and K % 2 != 0: N = 10 if K % 7 == 0: L = K * 9 // 7 else: L = K * 9 while True: if N % L == 1: ret = i break N = (N * 10 )% L i += 1 print(ret)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612]]
5
82
#include <bits/stdc++.h> using namespace std; int main() { long long k; cin >> k; long long mod; mod = 7; int count = 1; for (int i = 0; i < 10000000; i++) { if (i == 9999999) { cout << -1 << endl; } else if (mod == k) { cout << count << endl; break; } else if (mod > k) ...
#include <bits/stdc++.h> using namespace std; int main() { long long k; cin >> k; long long mod; mod = 7; int count = 1; for (int i = 0; i < 10000000; i++) { if (i == 9999999) { cout << -1 << endl; } else if (mod % k == 0) { cout << count << endl; break; } else if (mod >...
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95], ["+", 75, 76, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 75, 76, 0, 57, 75, 76, 0, 9, 0, 46]]
1
104
#C_Repsept import math K = int(input()) if K % 7 == 0 : L = 9 * K / 7 else: L = 9 * K X = 0 kekka = 1 total = -1 if L % 2 == 1: if L % 5 != 0: for i in range(L): # X = pow(10,i) % L kekka = kekka * 10 % L if kekka == 1: total = i+1 ...
#C_Repsept K = int(input()) if K % 7 == 0 : L = int( 9 * K / 7 ) else: L = 9 * K X = 0 kekka = 1 total = -1 if L % 2 == 1: if L % 5 != 0: for i in range(L): kekka = kekka * 10 % L if kekka == 1: total = i+1 break # 出力 print(total)
[["-", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["-", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
88
K=int(input()) n=1 an=7 for i in range(K+10): n+=1 an=(10*an+7)%K if an==0: print(n) exit() print(-1)
K=int(input()) n=0 an=0 for i in range(K+10): n+=1 an=(10*an+7)%K if an==0: print(n) exit() print(-1)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
55
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define size(a) int((a).size()) #define present(c, x) (c.find(x) != c.end()) #define printArray(arr) \ for (int i = 0; i < size(arr); i++) ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define size(a) int((a).size()) #define present(c, x) (c.find(x) != c.end()) #define printArray(arr) \ for (int i = 0; i < size(arr); i++) ...
[["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22]]
1
297
// // Created by bytedance on 2020/4/10. // #include <bits/stdc++.h> using namespace std; int main() { int k; scanf("%d", &k); unordered_set<int> s; int now = 7; int cnt = 1; while (true) { if (now == 0) { printf("%d\n", cnt); return 0; } now = now * 10 + 7; now = now % k; ...
// // Created by bytedance on 2020/4/10. // #include <bits/stdc++.h> using namespace std; int main() { int k; scanf("%d", &k); unordered_set<int> s; int now = 7 % k; int cnt = 1; while (true) { if (now == 0) { printf("%d\n", cnt); return 0; } now = now * 10 + 7; now = now % k;...
[["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
120
#include <bits/stdc++.h> #define Phuong_ \ ios_base::sync_with_stdio(0); \ cin.tie(0); /// easy access ------------- using namespace std; using ll = long long; using ull = unsigned long long; using ld = lo...
#include <bits/stdc++.h> #define Phuong_ \ ios_base::sync_with_stdio(0); \ cin.tie(0); /// easy access ------------- using namespace std; using ll = long long; using ull = unsigned long long; using ld = lo...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
156
#include <bits/stdc++.h> using namespace std; signed main() { long long k; cin >> k; long long ans = 0; for (long long i = 2; i <= k + 1; i++) { ans = ans * 10 + 7; if (ans % k == 0) { cout << i - 13; return 0; } ans = ans % k; } cout << "-1"; return 0; }
#include <bits/stdc++.h> using namespace std; signed main() { long long k; cin >> k; long long ans = 0; for (long long i = 2; i <= k + 1; i++) { ans = ans * 10 + 7; if (ans % k == 0) { cout << i - 1; return 0; } ans = ans % k; } cout << "-1"; return 0; }
[["-", 64, 9, 0, 1, 0, 16, 12, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 12, 16, 12, 13]]
1
87
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = (a); i < (b); ++i) #define trav(a, x) for (auto &a : x) #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define sz(x) ((int)(x).size()) #define endl '\n' typedef long long ll; typedef pair<int, int> pii; ty...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = (a); i < (b); ++i) #define trav(a, x) for (auto &a : x) #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define sz(x) ((int)(x).size()) #define endl '\n' typedef long long ll; typedef pair<int, int> pii; ty...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22]]
1
239
#include <cstdio> typedef long long ll; const int INF = 0x3fffffff; ll n; int min(int a, int b) { return a < b ? a : b; } // 欧拉函数的板子,返回 phi(x) int get_phi(int x) { int res = x; for (int i = 2; i <= x / i; i++) if (x % i == 0) { res -= res / i; while (x % i == 0) x /= i; } if (x > ...
#include <cstdio> typedef long long ll; const int INF = 0x3fffffff; ll n; int min(int a, int b) { return a < b ? a : b; } // 欧拉函数的板子,返回 phi(x) int get_phi(int x) { int res = x; for (int i = 2; i <= x / i; i++) if (x % i == 0) { res -= res / i; while (x % i == 0) x /= i; } if (x > ...
[["+", 0, 11, 12, 16, 31, 16, 31, 16, 12, 13], ["+", 64, 1, 0, 11, 12, 16, 31, 16, 17, 48], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 17, 48]]
1
306
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; typedef long long ll; const ll INF = 0x3fffffffffffffffll; /* 11111 = 99999 / 9 = (10 ^ 6 - 1) / 9 (10 ^ n - 1) / 9 */ ll n; inline ll get_phi(ll x) { ll res = x; for (int i = 2; i <= x / i; i++) if (x % i...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; typedef long long ll; const ll INF = 0x3fffffffffffffffll; /* 11111 = 99999 / 9 = (10 ^ 6 - 1) / 9 (10 ^ n - 1) / 9 */ ll n; inline ll get_phi(ll x) { ll res = x; for (int i = 2; i <= x / i; i++) if (x % i...
[["-", 8, 9, 0, 57, 64, 9, 0, 52, 0, 89], ["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121]]
1
307
k=int(input()) num=k%7 for i in range(1, 10**7+1): if num%k==0: print(i) exit() else: num=(num*10+7)%k print(-1)
k=int(input()) num=7%k for i in range(1, 10**7+1): if num%k==0: print(i) exit() else: num=(num*10+7)%k print(-1)
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22]]
5
59
#include <iostream> using namespace std; int main(void) { long long k; cin >> k; long long amari = k % 7; for (int i = 1; i <= k; i++) { if (amari == 0) { cout << i << endl; return 0; } amari = (amari * 10 + 7) % k; } cout << -1 << endl; return 0; }
#include <iostream> using namespace std; int main(void) { long long k; cin >> k; long long amari = 7 % k; for (int i = 1; i <= k; i++) { if (amari == 0) { cout << i << endl; return 0; } amari = (amari * 10 + 7) % k; } cout << -1 << endl; return 0; }
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
83
k = int(input()) flag = False resid = 7 if k == 7: i = -1 flag = True else: for i in range(k): resid = (resid*10+7)%k if resid == 0: flag = True break if flag: print(i+2) else: print(-1)
k = int(input()) flag = False resid = 7 if resid%k==0: i = -1 flag = True else: for i in range(k): resid = (resid*10+7)%k if resid == 0: flag = True break if flag: print(i+2) else: print(-1)
[["+", 0, 656, 0, 57, 15, 666, 0, 657, 31, 22], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 109], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612]]
5
72
#include <bits/stdc++.h> using namespace std; int ans, k; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> k; int num = 7; for (int i = 1; i <= k; i++) { if (num == 0) { cout << i << '\n'; return 0; } num = (num * 10 + 7) % k; } cout << "-1\n";...
#include <bits/stdc++.h> using namespace std; int ans, k; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> k; int num = 7 % k; for (int i = 1; i <= k; i++) { if (num == 0) { cout << i << '\n'; return 0; } num = (num * 10 + 7) % k; } cout << "-1...
[["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
104
k = int(input()) ans = 1 mod = 7 for i in range(k): if mod % 7 == 0: break ans += 1 mod = (mod * 10 + 7) % k if mod % k == 0: print(ans) else: print(-1)
k = int(input()) ans = 1 mod = 7 for i in range(k): if mod % k == 0: break ans += 1 mod = (mod * 10 + 7) % k if mod % k == 0: print(ans) else: print(-1)
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 22]]
5
62
#include <bits/stdc++.h> const long long INF = 1LL << 60; const long long MOD = 1000000007; const double PI = acos(-1.0); #define rep(i, n) for (ll i = 0; i < (n); ++i) #define rep1(i, n) for (ll i = 1; i <= (n); ++i) #define rrep(i, n) for (ll i = (n - 1); i >= 0; --i) #define perm(c) ...
#include <bits/stdc++.h> const long long INF = 1LL << 60; const long long MOD = 1000000007; const double PI = acos(-1.0); #define rep(i, n) for (ll i = 0; i < (n); ++i) #define rep1(i, n) for (ll i = 1; i <= (n); ++i) #define rrep(i, n) for (ll i = (n - 1); i >= 0; --i) #define perm(c) ...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 108], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
1,530
#include <bits/stdc++.h> using namespace std; int main(void) { int n; cin >> n; int cnt = 0, ans = 0; for (int i = 0; i < 1e7; i++) { cnt = (cnt * 10 + 7) % n; ans += 1; if (cnt == 0) { break; } } if (ans == 0) { cout << -1; } else { cout << ans; } }
#include <bits/stdc++.h> using namespace std; int main(void) { int n; cin >> n; int cnt = 0, ans = 0; for (int i = 0; i < 1e7; i++) { cnt = (cnt * 10 + 7) % n; ans += 1; if (cnt == 0) { break; } } if (ans == 1e7) { cout << -1; } else { cout << ans; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
90
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #define ll long long using namespace std; int n; int main() { scanf("%d", &n); if (n % 2 == 0 || n % 10 == 5 || n % 10 == 6) { printf("-1\n"); return 0; } int sum = 1; for (int i = 1; i <= n; i++) { if (sum % n == 0) { ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #define ll long long using namespace std; int n; int main() { scanf("%d", &n); if (n % 2 == 0 || n % 10 == 5 || n % 10 == 6) { printf("-1\n"); return 0; } int sum = 1; for (int i = 1; i <= n; i++) { if ((7 * sum) % n == 0) ...
[["+", 15, 339, 51, 16, 31, 16, 31, 23, 0, 24], ["+", 51, 16, 31, 16, 31, 23, 0, 16, 31, 13], ["+", 51, 16, 31, 16, 31, 23, 0, 16, 17, 48], ["+", 15, 339, 51, 16, 31, 16, 31, 23, 0, 25]]
1
134
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int K; cin >> K; if (K % 7 == 0) { K /= 7; } ll x = 1; int ans = 0; while (x % K != 0 && ans < 10000000) { ans++; x = 10 * x + 1; } if (ans == 10000000) { cout << -1 << endl; return 0; } cout << an...
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int K; cin >> K; if (K % 7 == 0) { K /= 7; } ll x = 1; int ans = 0; while (x % K != 0 && ans < 10000000) { ans++; x = 10 * x + 1; x %= K; } if (ans == 10000000) { cout << -1 << endl; return 0; } ...
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
99
#pragma GCC optimize("O3") //コンパイラ最適化用 #define _GLIBCXX_DEBUG //配列に[]でアクセス時のエラー表示 #include <algorithm> //sort,二分探索,など #include <bitset> //固定長bit集合 #include <cassert> //assert(p)で,not pのときにエラー #include <chrono> //実行時間計測 #include <cmath> //pow,logなど #include <complex> //複素数 #include <cstring> ...
#pragma GCC optimize("O3") //コンパイラ最適化用 #define _GLIBCXX_DEBUG //配列に[]でアクセス時のエラー表示 #include <algorithm> //sort,二分探索,など #include <bitset> //固定長bit集合 #include <cassert> //assert(p)で,not pのときにエラー #include <chrono> //実行時間計測 #include <cmath> //pow,logなど #include <complex> //複素数 #include <cstring> ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
899
#include <bits/stdc++.h> using namespace std; int main() { int k, u = 0; cin >> k; for (int i = 1; i <= k; i++) { u = u * 10 + 7; if (u % k == 0) { cout << i; return 0; } } cout << -1; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int k, u = 0; cin >> k; for (int i = 1; i <= k; i++) { u = (u * 10 + 7) % k; if (u % k == 0) { cout << i; return 0; } } cout << -1; return 0; }
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
71
import sys input = sys.stdin.readline def main(): K = int(input()) if K%2==0 or K%5==0: print(-1) return if K % 7: L = 9*K else: L = 9*K//7 a = 1 for i in range(1,K): a = (a * 10) % L if a == 1: print(i) return ...
import sys input = sys.stdin.readline def main(): K = int(input()) if K%2==0 or K%5==0: print(-1) return if K % 7: L = 9*K else: L = 9*K//7 a = 1 for i in range(1,K+10): a = (a * 10) % L if a == 1: print(i) return...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
100
import sys input - sys.stdin.readline def main(): K = int(input()) if K%2==0: print(-1) return if K % 7: L = 9*K else: L = 9*K//7 a = 1 for i in range(1,K+10): a = (a * 10) % L if a == 1: print(i) return print(...
import sys input = sys.stdin.readline def main(): K = int(input()) if K%2==0: print(-1) return if K % 7: L = 9*K else: L = 9*K//7 a = 1 for i in range(1,K+10): a = (a * 10) % L if a == 1: print(i) return print...
[["-", 36, 36, 0, 656, 0, 1, 0, 657, 17, 33], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32]]
5
96
K=int(input()) num=7 for i in range(100000): modnum=num%K if modnum==0: print(i+1) exit() num=modnum*10+7 print(-1)
K=int(input()) num=7 for i in range(1000000): modnum=num%K if modnum==0: print(i+1) exit() num=modnum*10+7 print(-1)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
50
k=int(input()) if (k%2==0) or (k%5==0): print(-1) exit() if k%7==0: k//=7 o=0 m=1 if k==1: print(1) exit() for i in range(1,k): m*=10 m=m%k o+=m%k o%=k if o==0: print(i) exit()
k=int(input()) if (k%2==0) or (k%5==0): print(-1) exit() if k%7==0: k//=7 o=0 m=1 if k==1: print(1) exit() for i in range(k): m*=10 m=m%k o+=m%k o%=k if o==0: print(i+1) exit()
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
99
#include <bits/stdc++.h> #define FAST \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL) using namespace std; using ll = lo...
#include <bits/stdc++.h> #define FAST \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL) using namespace std; using ll = lo...
[["-", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13]]
1
109
# k = int(input()) K = input() k = int(K) # if k%2 == 0: # print(-1) # exit() # r7 = 7%k r = 0 for i in range(1,k): r = (r*10 + 7)%k # print('r {} i {}'.format(r,i)) if r == 0: print(i) exit() # print(n) print(-1)
# k = int(input()) K = input() k = int(K) # if k%2 == 0: # print(-1) # exit() # r7 = 7%k r = 0 for i in range(1,k*10): r = (r*10 + 7)%k # print('r {} i {}'.format(r,i)) if r == 0: print(i) exit() # print(n) print(-1)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 48], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
59
#include <bits/stdc++.h> using namespace std; #define UTIDOME 200000000 #define DECIMAL 10 int k; int main(void) { cin >> k; int amariTmp = 7 % k, amari = amariTmp; if (amari == 0) { cout << 1 << endl; } for (int i = 2; i <= UTIDOME; i++) { amariTmp = (amariTmp * DECIMAL) % k; amari = (amari +...
#include <bits/stdc++.h> using namespace std; #define UTIDOME 100000000 #define DECIMAL 10 int k; int main(void) { cin >> k; int amariTmp = 7 % k, amari = amariTmp; if (amari == 0) { cout << 1 << endl; return 0; } for (int i = 2; i <= UTIDOME; i++) { amariTmp = (amariTmp * DECIMAL) % k; am...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13]]
1
113
import java.util.*; public class Main { static int gcd(int a, int b) { return b > 0 ? gcd(b, a % b) : a; } static long mod = 1000000007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int K = sc.nextInt(); int modK = 7 % K; int plusmod = 7 % K; for (int i = 1...
import java.util.*; public class Main { static int gcd(int a, int b) { return b > 0 ? gcd(b, a % b) : a; } static long mod = 1000000007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int K = sc.nextInt(); int modK = 7 % K; int plusmod = 7 % K; for (int i = 1...
[["+", 8, 196, 0, 7, 15, 16, 12, 16, 17, 48], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499]]
3
164
#include <iostream> using namespace std; int n, now = 7; int main() { cin >> n; for (int i = 1; i <= 1000000; i++) { now = now * 10 % (9 * n); if (now == 7) { cout << i; return 0; } } }
#include <iostream> using namespace std; int n, now = 7; int main() { cin >> n; for (int i = 1; i <= 1000000; i++) { now = now * 10 % (9 * n); if (now == 7) { cout << i; return 0; } } cout << -1; }
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
66
#include <bits/stdc++.h> using namespace std; typedef long long ll; int k; ll qpow(ll a, ll b, ll modd) { ll ans = 1, base = a; while (b) { if (b & 1) ans = ans * base % modd; b >>= 1, base = base * base % modd; } return ans; } int main() { ios::sync_with_stdio(false); cin.tie(0), cout.tie...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int k; ll qpow(ll a, ll b, ll modd) { ll ans = 1, base = a; while (b) { if (b & 1) ans = ans * base % modd; b >>= 1, base = base * base % modd; } return ans; } int main() { ios::sync_with_stdio(false); cin.tie(0), cout.tie...
[["+", 15, 339, 51, 16, 31, 16, 31, 16, 31, 13], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 17, 48]]
1
185
K = int(input()) if K % 2 == 0: print(-1) else: mod = K t = 7 for _ in range(K+1): t *= 10 t += 7 if t % mod == 0: print(_+2) exit(0) else: t %= mod print(-1)
K = int(input()) if K % 2 == 0: print(-1) else: mod = K t = 0 for _ in range(K+1): t *= 10 t += 7 if t % mod == 0: print(_+1) exit(0) else: t %= mod print(-1)
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
71
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { long long K; cin >> K; long long ans = -1; if (K % 2 == 1) { if (K == 1 || K == 7) { ans = 1; } else { vector<long long> amari(1); vector<long long> sumamari(1); amari...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { long long K; cin >> K; long long ans = -1; if (K % 2 == 1) { if (K == 1 || K == 7) { ans = 1; } else { vector<long long> amari(1); vector<long long> sumamari(1); amari...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13]]
1
218
#include <math.h> #include <stdio.h> int main(void) { long K, i; int flag = 0, c = 0; long long n = 7; scanf("%ld", &K); if (K % 2 == 0 || K % 5 == 0) { flag = 1; } else { for (i = 0; i < 1000000; i++) { c++; if (n % K == 0) { flag = 1; break; } n = n % K; ...
#include <math.h> #include <stdio.h> int main(void) { long K, i; int flag = 0, c = 0; long long n = 7; scanf("%ld", &K); if (K % 2 == 0 || K % 5 == 0) { flag = 0; } else { for (i = 0; i < 1000000; i++) { c++; if (n % K == 0) { flag = 1; break; } n = n % K; ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13]]
0
144
#include <bits/stdc++.h> #define int long long #define FASTIO \ ios::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); using namesp...
#include <bits/stdc++.h> #define int long long #define FASTIO \ ios::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); using namesp...
[["-", 0, 14, 8, 9, 0, 52, 15, 339, 51, 146], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 109], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22]]
1
111
K = gets.to_i r = -1 m = 1 % K K.times{|i| if m == 0 r = i + 1 break end m = m * 10 + 1 m %= K } puts r
K = gets.to_i r = -1 m = 7 % K K.times{|i| if m == 0 r = i + 1 break end m = m * 10 + 7 m %= K } puts r
[["-", 36, 36, 0, 493, 0, 662, 12, 738, 31, 612], ["+", 36, 36, 0, 493, 0, 662, 12, 738, 31, 612], ["-", 196, 196, 8, 734, 0, 662, 12, 738, 12, 612], ["+", 196, 196, 8, 734, 0, 662, 12, 738, 12, 612]]
4
45
K = int(input()) mod = 0 # mod Kは、0,1,...,K-1 の高々K種類 # i=K+1 まで行くと鳩の巣原理よりmodが既出になり、以降ループ # すなわちi=Kまで見れば十分 for i in range(1, K + 1): mod = (10 * mod + 7) % K if mod % K == 0: print(i) exit()
K = int(input()) mod = 0 # mod Kは、0,1,...,K-1 の高々K種類 # i=K+1 まで行くと鳩の巣原理よりmodが既出になり、以降ループ # すなわちi=Kまで見れば十分 for i in range(1, K + 1): mod = (10 * mod + 7) % K if mod % K == 0: print(i) exit() print(-1)
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
51
import bisect import copy import heapq import math import sys from collections import * from functools import lru_cache from itertools import accumulate, combinations, permutations, product def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) sys.setrecursionlimit(500...
import bisect import copy import heapq import math import sys from collections import * from functools import lru_cache from itertools import accumulate, combinations, permutations, product def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) sys.setrecursionlimit(500...
[["+", 8, 196, 0, 52, 15, 657, 31, 657, 31, 612], ["+", 8, 196, 0, 52, 15, 657, 31, 657, 17, 48]]
5
194
import bisect import copy import heapq import math import sys from collections import * from functools import lru_cache from itertools import accumulate, combinations, permutations, product def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) sys.setrecursionlimit(500...
import bisect import copy import heapq import math import sys from collections import * from functools import lru_cache from itertools import accumulate, combinations, permutations, product def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) sys.setrecursionlimit(500...
[["+", 75, 76, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 108], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 12, 612]]
5
199
k = int(input()) if k % 2 == 0 or k % 5 == 0: print(-1) exit() i = 7 cnt = 1 while i != 0: i = i * 10 + 7 i %= 7 cnt += 1 print(cnt)
k = int(input()) if k % 2 == 0 or k % 5 == 0: print(-1) exit() i = 7 % k cnt = 1 while i != 0: i = i * 10 + 7 i %= k cnt += 1 print(cnt)
[["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22], ["-", 0, 52, 8, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 12, 22]]
5
57
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 5; #define ll long long int main() { ios::sync_with_stdio(0); cin.tie(0); ll k; cin >> k; ll seven = 7; int ans = -1; for (int i = 1; i < 1e7; i++) { if (seven == 0) { ans = i; break; } seven = (seven * 10 + 7) % k...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 5; #define ll long long int main() { ios::sync_with_stdio(0); cin.tie(0); ll k; cin >> k; ll seven = 7 % k; int ans = -1; for (int i = 1; i < 1e7; i++) { if (seven == 0) { ans = i; break; } seven = (seven * 10 + 7)...
[["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
104
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ll MOD = 1000000007; // const ll MOD = 998244353; const ll INF = MOD * MOD; const long double EPS = 1e-12; struct mint { ll x; mint(ll x = 0) : x((x % MOD + MOD) % MOD) {} mint operator-() const { return mint(-x); }...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ll MOD = 1000000007; // const ll MOD = 998244353; const ll INF = MOD * MOD; const long double EPS = 1e-12; struct mint { ll x; mint(ll x = 0) : x((x % MOD + MOD) % MOD) {} mint operator-() const { return mint(-x); }...
[["+", 0, 57, 64, 9, 0, 1, 0, 2, 63, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
14,855
#include <bits/stdc++.h> using namespace std; int solve(const int K) { for (int i = 1, sevens = 7; i <= K; ++i, sevens = (sevens * 10 + 7) % K) { if (sevens == 0) return i; } return -1; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int K; cin >> K; cout << solve(K) << '\n'; r...
#include <bits/stdc++.h> using namespace std; int solve(const int K) { for (int i = 1, sevens = 7 % K; i <= K; ++i, sevens = (sevens * 10 + 7) % K) { if (sevens == 0) return i; } return -1; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int K; cin >> K; cout << solve(K) << '\n'; ...
[["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 109], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 22]]
1
100
k = gets.chomp.to_i if k == 7 p 1 exit end ans = 0 x = 7%k i = 1 s =false while i <= k x =(x*10+7)%k if x == 0 s = true break end i += 1 end if s p i+1 else p -1 end
k = gets.chomp.to_i if k == 7 || k == 1 p 1 exit end ans = 0 x = 7%k i = 1 s =false while i <= k x =(x*10+7)%k if x == 0 s = true break end i += 1 end if s p i+1 else p -1 end
[["+", 36, 36, 0, 493, 0, 121, 15, 738, 17, 106], ["+", 0, 493, 0, 121, 15, 738, 12, 738, 31, 22], ["+", 0, 493, 0, 121, 15, 738, 12, 738, 17, 60], ["+", 0, 493, 0, 121, 15, 738, 12, 738, 12, 612]]
4
68
/* h s, d't skp th si tll i's sved * ABC141 E * ABC145 D * ABC147 F */ #include <bits/stdc++.h> #define ll long long #define mod 1000000007 using namespace std; int main() { ll n; cin >> n; ll ans = -1; ll t = 10; ll st = 7; for (ll i = 0; i <= 1e7; i++) { if (st == 0) { ans = i + 1; brea...
/* h s, d't skp th si tll i's sved * ABC141 E * ABC145 D * ABC147 F */ #include <bits/stdc++.h> #define ll long long #define mod 1000000007 using namespace std; int main() { ll n; cin >> n; ll ans = -1; ll t = 10; ll st = 7 % n; for (ll i = 0; i <= 1e7; i++) { if (st == 0) { ans = i + 1; ...
[["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
106
k=int(input()) num=7%k ans=-1 if k%2==0 or k%5==0: ans=-1 else: for i in range(1,k): # print(num) if num==0: ans=i break num=(num*10+7)%k print(ans)
k=int(input()) num=7%k ans=-1 if k%2==0 or k%5==0: ans=-1 else: for i in range(1,k+10): # print(num) if num==0: ans=i break num=(num*10+7)%k print(ans)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
71
K = int(input()) a = 7 for i in range(1, K): if a % K == 0: print(i) break a = (10 * a + 7) % K else: print(-1)
K = int(input()) a = 7 for i in range(K): if a % K == 0: print(i + 1) break a = (10 * a + 7) % K else: print(-1)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
51
#include <bits/stdc++.h> #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); ...
#include <bits/stdc++.h> #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
82
#include <bits/stdc++.h> using namespace std; int main() { int K; cin >> K; int x = 7 % K; for (int i = 0; i < K; i++) { if (x == 0) { cout << i << endl; return 0; } x = (x * 10 + 7) % K; } cout << -1 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int K; cin >> K; int x = 7 % K; for (int i = 1; i <= K; ++i) { if (x == 0) { cout << i << endl; return 0; } x = (x * 10 + 7) % K; } cout << -1 << endl; return 0; }
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 14, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 28, 22]]
1
80
#include <bits/stdc++.h> using namespace std; int main() { int K; cin >> K; int x = 7 % K; set<int> S; for (int i = 0; i < K; i++) { if (x == 0) { cout << i << endl; return 0; } x = (x * 10 + 7) % K; } cout << -1 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int K; cin >> K; int x = 7 % K; set<int> S; for (int i = 1; i <= K; ++i) { if (x == 0) { cout << i << endl; return 0; } x = (x * 10 + 7) % K; } cout << -1 << endl; return 0; }
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 14, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 28, 22]]
1
86
#include <bits/stdc++.h> using namespace std; int main() { long long K; cin >> K; if (K == 7) { cout << "1" << endl; return 0; } long long amari = fmod(7, K); for (long long i = 1; i <= K; i++) { if (fmod((amari * 10 + 7), K) == 0) { cout << i + 1 << endl; return 0; } amari ...
#include <bits/stdc++.h> using namespace std; int main() { long long K; cin >> K; if (K == 7 || K == 1) { cout << "1" << endl; return 0; } long long amari = fmod(7, K); for (long long i = 1; i <= K; i++) { if (fmod((amari * 10 + 7), K) == 0) { cout << i + 1 << endl; return 0; } ...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
118
#include <bits/stdc++.h> using namespace std; using ll = long long; map<ll, ll> mods; long long mod(ll a, ll b, ll k) { // return (a^b)%k if (b == 0) return 1; ll res = mod(a, b / 2, k); res *= res; res %= k; if (b & 1) { res *= a; res %= k; } return res; } int main() { long long k; s...
#include <bits/stdc++.h> using namespace std; using ll = long long; map<ll, ll> mods; long long mod(ll a, ll b, ll k) { // return (a^b)%k if (b == 0) return 1; ll res = mod(a, b / 2, k); res *= res; res %= k; if (b & 1) { res *= a; res %= k; } return res; } int main() { long long k; s...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
236
#include <bits/stdc++.h> #define ll long long #define PB push_back #define MP make_pair #define REP(i, n) for (int i = 0; i < (int)(n); ++i) #define FOR(i, l, h) for (int i = (int)(l); i <= (int)(h); ++i) #define FORD(i, h, l) for (int i = (int)(h); i >= (int)(l); --i) //#define max(a,b) a>b?a:b //#define min(a,b) ...
#include <bits/stdc++.h> #define ll long long #define PB push_back #define MP make_pair #define REP(i, n) for (int i = 0; i < (int)(n); ++i) #define FOR(i, l, h) for (int i = (int)(l); i <= (int)(h); ++i) #define FORD(i, h, l) for (int i = (int)(h); i >= (int)(l); --i) //#define max(a,b) a>b?a:b //#define min(a,b) a...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 64, 9, 0, 1, 0, 16, 12, 16, 17, 109], ["-", 64, 9, 0, 1, 0, 16, 12, 16, 12, 22]]
1
320
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int k = sc.nextInt(); long l = 7; int ans = 0; for (int i = 1; i <= k; i++) { if (l % k == 0) { ans = i; break; } l = (l * 10 + 7) % k; ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int k = sc.nextInt(); long l = 7; int ans = -1; for (int i = 1; i <= k; i++) { if (l % k == 0) { ans = i; break; } l = (l * 10 + 7) % k; ...
[["-", 0, 195, 8, 196, 0, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 503, 49, 200, 51, 91, 17, 33], ["+", 8, 196, 0, 503, 49, 200, 51, 91, 439, 499]]
3
107
#include <bits/stdc++.h> using namespace std; #define ll long long #define f first #define s second #define Fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define fo(a, b, c) for (int i = a; i < b...
#include <bits/stdc++.h> using namespace std; #define ll long long #define f first #define s second #define Fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define fo(a, b, c) for (int i = a; i < b...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94]]
1
647
#include <iostream> using namespace std; int main() { long long int n; cin >> n; long long int i = 1; long long int k = 7; int temp = 0; while (i < n) { if (k % n == 0) { cout << i << endl; temp = 1; break; } k = (k % n) * 10 + 7; i++; } if (temp == 0) cout << "-1...
#include <iostream> using namespace std; int main() { long long int n; cin >> n; long long int i = 1; long long int k = 7; int temp = 0; while (i <= n) { if (k % n == 0) { cout << i << endl; temp = 1; break; } k = (k % n) * 10 + 7; i++; } if (temp == 0) cout << "-...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19]]
1
102
import sys input = sys.stdin.readline k = int(input()) if k == 7: print(1) elif k % 2 == 0 or k % 5 == 0: print(-1) else: if k % 7 == 0: k = k // 7 mod = 9*k i = 1; result = 10; while result != 1: result = (result * 10) % mod i += 1 print(i)
import sys input = sys.stdin.readline k = int(input()) if k == 7 or k == 1: print(1) elif k % 2 == 0 or k % 5 == 0: print(-1) else: if k % 7 == 0: k = k // 7 mod = 9*k i = 1; result = 10; while result != 1: result = (result * 10) % mod i += 1 print(i)
[["+", 36, 36, 0, 656, 0, 57, 15, 679, 17, 354], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 667, 60], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 612]]
5
92
#include <bits/stdc++.h> #include <math.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using ll = long long; using vec = vector<int>; using vec2 = vector<vector<int>>; ll inf = pow(2, 62); int main() { ll k; cin >> k; ll o =...
#include <bits/stdc++.h> #include <math.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using ll = long long; using vec = vector<int>; using vec2 = vector<vector<int>>; ll inf = pow(2, 62); int main() { ll k; cin >> k; ll o =...
[["-", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
142
#include <bits/stdc++.h> using namespace std; #define faster \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define sq(x) ...
#include <bits/stdc++.h> using namespace std; #define faster \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define sq(x) ...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
118
k = int(input()) ans = 0 if k % 7 == 0: L = (9 * k) / 7 else: L = 9 * k if L % 2 == 0 or L % 5 == 0: print(-1) else: a = 1 % L for i in range(L): if (a * 10) % L == 1: ans = i + 1 print(ans) break a = (a * 10) % L if ans == 0: print(-1)
k = int(input()) ans = 0 if k % 7 == 0: L = int((9 * k) / 7) else: L = 9 * k if L % 2 == 0 or L % 5 == 0: print(-1) else: a = 1 % L for i in range(L): if (a * 10) % L == 1: ans = i + 1 print(ans) break a = (a * 10) % L if ans == 0: prin...
[["+", 64, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
107
#include <iostream> using namespace std; int main() { long int n, count = 1, a = 7; cin >> n; if (n % 2 == 0 || n % 5 == 0) cout << "-1"; else while (true) { if (a % n == 0) { cout << count; break; } if (count > n) { cout << "-1"; break; } a ...
#include <iostream> using namespace std; int main() { long int n, count = 1, a = 7; cin >> n; if (n % 2 == 0 || n % 5 == 0) cout << "-1"; else while (true) { if (a % n == 0) { cout << count; break; } if (count > n) { cout << "-1"; break; } a ...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 75, 76, 0, 52, 8, 9, 0, 1, 0, 35]]
1
102
#include <bits/stdc++.h> #define ff \ { \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
#include <bits/stdc++.h> #define ff \ { \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
119