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; typedef long long ll; int main() { int K; cin >> K; if (K == 1) { cout << "1\n"; return 0; } if (K % 2 == 0 || K < 7 || K % 5 == 0) { cout << "-1\n"; return 0; } if (K % 7 == 0) K /= 7; K *= 9; int a = 10; for (int i = 0; i <= 10 * ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int K; cin >> K; if (K == 1) { cout << "1\n"; return 0; } if (K % 2 == 0 || K % 5 == 0) { cout << "-1\n"; return 0; } if (K % 7 == 0) K /= 7; K *= 9; int a = 10; for (int i = 0; i <= 10 * K; i++) {...
[["-", 15, 339, 51, 16, 31, 16, 12, 16, 17, 18], ["-", 15, 339, 51, 16, 31, 16, 12, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["-", 15, 339, 51, 16, 12, 16, 31, 16, 31, 22]]
1
147
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define int long long #define pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define vvi vector<vi> #define vb vector<bool> #define vvb vector<vb> #define mii map<int, int> #define pqb priority_queue<i...
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define int long long #define pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define vvi vector<vi> #define vb vector<bool> #define vvb vector<vb> #define mii map<int, int> #define pqb priority_queue<i...
[["+", 64, 9, 0, 1, 0, 16, 12, 16, 17, 72], ["+", 64, 9, 0, 1, 0, 16, 12, 16, 12, 13]]
1
274
// Author rahuliitkgp /*A thing of beauty is a joy forever, Its loveliness increases, it will never pass into nothingness.*/ // Men at Work :) #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; typedef long long int ll; #define setbits(x) __builtin_popc...
// Author rahuliitkgp /*A thing of beauty is a joy forever, Its loveliness increases, it will never pass into nothingness.*/ // Men at Work :) #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; typedef long long int ll; #define setbits(x) __builtin_popc...
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
294
#include <bits/stdc++.h> #define endl '\n' #define mod 1000000007 #define ll long long #define trace(x) cerr << #x << " = " << x << endl using namespace std; int main() { /* #ifndef ONLINE_JUDGE freopen("input.txt","r",stdin); freopen("ouput.txt","w",stdout); #endif*/ ios_base::sync_with_stdio(0); ...
#include <bits/stdc++.h> #define endl '\n' #define mod 1000000007 #define ll long long #define trace(x) cerr << #x << " = " << x << endl using namespace std; int main() { /* #ifndef ONLINE_JUDGE freopen("input.txt","r",stdin); freopen("ouput.txt","w",stdout); #endif*/ ios_base::sync_with_stdio(0); ...
[["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 0, 57, 64, 9, 0, 37, 0, 34, 0, 21], ["+", 0, 57, 64, 9, 0, 37, 0, 34, 12, 13]]
1
136
/* The fool didn't know it was impossible. So he did it. maskman_lucifer */ #include <bits/stdc++.h> #define IO \ ios_base::sync_with_stdio(false); \ cin.tie(...
/* The fool didn't know it was impossible. So he did it. maskman_lucifer */ #include <bits/stdc++.h> #define IO \ ios_base::sync_with_stdio(false); \ cin.tie(...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13]]
1
191
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() using namespace std; using ll = int64_t; using ld = long double; using P = pair<int, int>; using vs = vector<string>; using vi = vector<int>; using vvi =...
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() using namespace std; using ll = int64_t; using ld = long double; using P = pair<int, int>; using vs = vector<string>; using vi = vector<int>; using vvi =...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 354], ["+", 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
388
#include <bits/stdc++.h> using namespace std; int main(void) { // Your code here! int K; cin >> K; int num = 0; for (int i = 0; i < 10; i++) { num = num * 10 + 7; num %= K; if (num) continue; cout << i + 1 << endl; return 0; } cout << -1 << endl; }
#include <bits/stdc++.h> using namespace std; int main(void) { // Your code here! int K; cin >> K; int num = 0; for (int i = 0; i < 10000000; i++) { num = num * 10 + 7; num %= K; if (num) continue; cout << i + 1 << endl; return 0; } cout << -1 << endl; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
77
#include <bits/stdc++.h> using namespace std; int main() { int mod, i, s = 0; cin >> mod; for (i = 1; i <= 1000000; i++) { s = s * 10 + 1; s %= mod; if (s) continue; cout << i << endl; return 0; } cout << "-1" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int mod, i, s = 0; cin >> mod; for (i = 1; i <= 1000000; i++) { s = s * 10 + 7; s %= mod; if (s) continue; cout << i << endl; return 0; } cout << "-1" << endl; return 0; }
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
78
K = int(input()) seven = 7 count = 0 if(K % 2 == 0 or K % 5 == 0): print(-1) if(K == 7): print(1) else: for i in range(1,10**6): seven = (seven * 10 + 7) % K if(seven % K == 0): print(i+1) break # これだと10^5以降の計算が遅くなる。countのせい?? # count += 1 # ...
K = int(input()) seven = 7 count = 0 if(K % 2 == 0 or K % 5 == 0): print(-1) if(K == 7 or K == 1): print(1) else: for i in range(1,10**6): seven = (seven * 10 + 7) % K if(seven % K == 0): print(i+1) break # これだと10^5以降の計算が遅くなる。countのせい?? # count += 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
89
//#pragma gcc optimize("Ofast,no-stack-protector,tune=native") //#pragma gcc optimize("sse,sse2,sse3,sse4,ssse3") //#pragma gcc optimize("O3") //#pragma gcc optimize("abm,mmx,avx,avx2,fast-math,section-anchors") //#pragma GCC optimize("Ofast,no-stack-protector,delete-null-pointer-check") //#pragma GCC target("tune=nati...
//#pragma gcc optimize("Ofast,no-stack-protector,tune=native") //#pragma gcc optimize("sse,sse2,sse3,sse4,ssse3") //#pragma gcc optimize("O3") //#pragma gcc optimize("abm,mmx,avx,avx2,fast-math,section-anchors") //#pragma GCC optimize("Ofast,no-stack-protector,delete-null-pointer-check") //#pragma GCC target("tune=nati...
[["-", 8, 9, 0, 7, 15, 16, 12, 74, 51, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 74, 51, 13], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 31, 13], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 17, 48]]
1
275
n = int(input()) if n==0: print(0) if n%2==0: print(-1) elif n%5==0: print(-1) else: k=7 l=1 while k!=0: l+=1 k*=10 k+=7 k%=n #print(k) print(l)
n = int(input()) if n==0: print(0) if n%2==0: print(-1) elif n%5==0: print(-1) else: k=7 l=1 k%=n while k!=0: l+=1 k*=10 k+=7 k%=n #print(k) print(l)
[["+", 75, 76, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 132], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 12, 22]]
5
71
#include <algorithm> #include <chrono> #include <iostream> #include <random> #define rep(i, x) for (ll i = 0; i < x; i++) using namespace std; typedef long long ll; const ll MOD = (ll)1e9 + 7; const ll N = 5e5 + 5, inf = 1e9 + 5000; ll add(ll x, ll y) { x += y; if (x >= MOD) return x - MOD; return x; } ll sub...
#include <algorithm> #include <chrono> #include <iostream> #include <random> #define rep(i, x) for (ll i = 0; i < x; i++) using namespace std; typedef long long ll; const ll MOD = (ll)1e9 + 7; const ll N = 5e5 + 5, inf = 1e9 + 5000; ll add(ll x, ll y) { x += y; if (x >= MOD) return x - MOD; return x; } ll sub...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106]]
1
269
K = int(input()) memo = set() repunit = 7 n = 1 while True: if repunit == 0: print(n) exit() else: if repunit in memo: print(-1) exit() else: memo.add(repunit) repunit = (repunit*10 + 7)%K n += 1
K = int(input()) memo = set() repunit = 7%K n = 1 while True: if repunit == 0: print(n) exit() else: if repunit in memo: print(-1) exit() else: memo.add(repunit) repunit = (repunit*10 + 7)%K n += 1
[["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22]]
5
71
def main(): k = int(input()) num = 1 n = 7 if (k % 2 == 0): print(-1) return for i in range(100000): if (n % k == 0): print(num) return else: n = (n*10 + 7) %k num += 1 print(-1) if __name__ == '__main__': ...
def main(): k = int(input()) num = 1 n = 7 if (k % 2 == 0): print(-1) return for i in range(1000000): if (n % k == 0): print(num) return else: n = (n*10 + 7) %k num += 1 print(-1) if __name__ == '__main__': ...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
87
k = int(input()) c = 0 start = 7 while c<=k: if start == 0: break c+=1 start = (start*10+7)%k if c>k: print(-1) else: print(c+1)
k = int(input()) c = 0 start = 7%k while c<=k: if start == 0: break c+=1 start = (start*10+7)%k if c>k: print(-1) else: print(c+1)
[["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22]]
5
57
#include <cmath> #include <iostream> #include <map> #include <vector> #define fast \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout....
#include <cmath> #include <iostream> #include <map> #include <vector> #define fast \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout....
[["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 12, 22]]
1
105
K = int(input()) ans = 1 X = 7 cnt = K while ans <= K: x = X % K if rem == 0: print(ans) break else: ans += 1 X = x*10 + 7 if rem != 0: print(-1)
K = int(input()) ans = 1 X = 7 cnt = K while ans <= K: x = X % K if x == 0: print(ans) break else: ans += 1 X = x*10 + 7 if x != 0: print(-1)
[["-", 0, 52, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 52, 8, 196, 0, 57, 15, 666, 0, 22], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
59
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() const ll INF = 1LL << 60; int main() { int k; cin >> k; // kが7より小さい時のために7%kにする int x = 7 % k; set<int> s; int i = 1; //カウ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() const ll INF = 1LL << 60; int main() { int k; cin >> k; // kが7より小さい時のために7%kにする int x = 7 % k; set<int> s; int i = 1; //カウ...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
137
k = int(input()) s = 7 for i in range(1, k): # rangeの上限がk if s % k == 0: print(i) break else: s = (s * 10 + 7) % k # %kが難しい else: # for文にもelseが使える print(-1)
k = int(input()) s = 7 for i in range(1, k+1): # rangeの上限がk if s % k == 0: print(i) break s = (s * 10 + 7) % k # %kが難しい else: # for文にもelseが使える print(-1)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102]]
5
56
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) const int INF = 1001001001; using ll = long long; using P = pair<int, int>; using Graph = vector<string>; Graph field; queue<P> q; int main() { ll k; cin >> k; ll a = 7; ll ans = 1; while (a != 0) { a = (10 * a ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) const int INF = 1001001001; using ll = long long; using P = pair<int, int>; using Graph = vector<string>; Graph field; queue<P> q; int main() { ll k; cin >> k; ll a = 7 % k; ll ans = 1; while (a != 0) { a = (10 ...
[["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
121
#include <bits/stdc++.h> #define ll long long int using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll k; cin >> k; if (k % 2 == 0) cout << -1 << endl; else { ll i; ll a = 7; ll ans; ans = -1; if (a % k == 0) { ans = 0; } else { a = a...
#include <bits/stdc++.h> #define ll long long int using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll k; cin >> k; if (k % 2 == 0) cout << -1 << endl; else { ll i; ll a = 7; ll ans; ans = -1; if (a % k == 0) { ans = 0; } else { a = a...
[["+", 0, 9, 0, 57, 75, 76, 0, 9, 0, 46], ["-", 0, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
156
#include <bits/stdc++.h> #include <bitset> #include <iostream> #include <stdio.h> #include <stdlib.h> #include <string> typedef long long ll; using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) const int mod = 1000000007; // const int mod = 998244353; struct mint { ll x; // typedef long long ll; ...
#include <bits/stdc++.h> #include <bitset> #include <iostream> #include <stdio.h> #include <stdlib.h> #include <string> typedef long long ll; using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) const int mod = 1000000007; // const int mod = 998244353; struct mint { ll x; // typedef long long ll; ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
889
#include <bits/stdc++.h> using namespace std; int main() { long long int k; cin >> k; int cnt = 0; if (k % 2 == 0) { cout << -1; return 0; } long long int val = 0; for (int i = 1; i <= k; i++) { cnt++; val = val * 10 + 7; if (val % k == 0) { cout << cnt; return 0; } }...
#include <bits/stdc++.h> using namespace std; int main() { long long int k; cin >> k; int cnt = 0; if (k % 2 == 0) { cout << -1; return 0; } long long int val = 0; for (int i = 1; i <= k; i++) { cnt++; val = val * 10 + 7; val = val % k; if (val == 0) { cout << cnt; retu...
[["-", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["-", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 3...
1
100
k = int(input()) x = 7%k s = [] for i in range(k): if x == 0: print(len(i+1)) exit() s.append(x) x = (10*x + 7)%k print(-1)
k = int(input()) x = 7%k s = [] for i in range(k): if x == 0: print(i+1) exit() s.append(x) x = (10*x + 7)%k print(-1)
[["-", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
64
#include <bits/stdc++.h> #include <iomanip> #include <numeric> #define ll long long #define intm INT_MAX #define llm LLONG_MAX using namespace std; typedef pair<int, int> P; const int MOD = 998244353; const ll mod = 1e9 + 7; const int mxN = 1e6 + 9; struct segtree { int sizee; vector<set<int>> s; void init(int...
#include <bits/stdc++.h> #include <iomanip> #include <numeric> #define ll long long #define intm INT_MAX #define llm LLONG_MAX using namespace std; typedef pair<int, int> P; const int MOD = 998244353; const ll mod = 1e9 + 7; const int mxN = 1e6 + 9; struct segtree { int sizee; vector<set<int>> s; void init(int...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 146], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 147]]
1
561
#define _GLIBCXX_DEBUG //提出時に消す #include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using pull = pair<ull, ll>; using pis = pair<int, string>; #define INF 1000000000 #define LLINF 10000000000000000ll #define MOD 100000...
#define _GLIBCXX_DEBUG //提出時に消す #include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using pull = pair<ull, ll>; using pis = pair<int, string>; #define INF 1000000000 #define LLINF 10000000000000000ll #define MOD 100000...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
164
#include <bits/stdc++.h> #define ll long long using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n; cin >> n; int k = 0; for (int i = 1; i < 1e7; i++) { k = (k * 10 + 7) % n; if (k == 0) { cout << i + 1 << endl; return 0; } } co...
#include <bits/stdc++.h> #define ll long long using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; int k = 0; for (int i = 0; i < 1e7; i++) { k = (k * 10 + 7) % n; if (k == 0) { cout << i + 1 << endl; return 0; } } c...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
104
#include <bits/stdc++.h> using namespace std; #define ll unsigned long long int int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll n; cin >> n; ll ans = -1; ll k = 0; for (ll i = 1; i <= 1000000; i++) { k = (k * 10) + 7; k = k % n; if (k == 0) { ans = i; break; ...
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll n; cin >> n; ll ans = -1; ll k = 0; for (ll i = 1; i <= 1000000; i++) { k = (k * 10) + 7; k = k % n; if (k == 0) { ans = i; break; } } ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
101
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("O3") #pragma GCC target("avx") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") typedef long long int ll; // #define int long long int #define IOS ...
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("O3") #pragma GCC target("avx") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") typedef long long int ll; // #define int long long int #define IOS ...
[["+", 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
371
// Working program using Reader Class import java.io.*; import java.util.*; public class Main { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { din = new DataInputStre...
// Working program using Reader Class import java.io.*; import java.util.*; public class Main { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { din = new DataInputStre...
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 35]]
3
727
#include <bits/stdc++.h> #include <string.h> #define rep(i, a, n) for (int i = int(a); i < int(n); i++) #define OUT freopen("output.txt", "w", stdout) #define IN freopen("input.txt", "r", stdin) #define mem(a, b) memset((a), (b), sizeof(a)) #define NumofDigits(n) ((int)log10(n) + 1) #define NumofBits(n) ((int)log2(n) +...
#include <bits/stdc++.h> #include <string.h> #define rep(i, a, n) for (int i = int(a); i < int(n); i++) #define OUT freopen("output.txt", "w", stdout) #define IN freopen("input.txt", "r", stdin) #define mem(a, b) memset((a), (b), sizeof(a)) #define NumofDigits(n) ((int)log10(n) + 1) #define NumofBits(n) ((int)log2(n) +...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
215
#include <bits/stdc++.h> using namespace std; #define LL long long #define ULL unsigned LL #define LD long double int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; LL x = 7; int ile = -1; if (n % x == 0) ile = 1; else { for (int i = 0; i < 2000004; i++) { ...
#include <bits/stdc++.h> using namespace std; #define LL long long #define ULL unsigned LL #define LD long double int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; LL x = 7; int ile = -1; if (x % n == 0) ile = 1; else { for (int i = 0; i < 2000004; i++) { ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22]]
1
122
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define rep2(i, s, n) for (long long i = (s); i < (long long)(n); i++) #define repi(i, n) for (int i = 0; i < (int)(n); i++) #define rep2i(i, s, n) for (int i = (s); i < (int)(n); i++) #define all(v) v.begin(...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define rep2(i, s, n) for (long long i = (s); i < (long long)(n); i++) #define repi(i, n) for (int i = 0; i < (int)(n); i++) #define rep2i(i, s, n) for (int i = (s); i < (int)(n); i++) #define all(v) v.begin(...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
749
#include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <string.h> #include <string> #include...
#include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <string.h> #include <string> #include...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
544
#include <bits/stdc++.h> using namespace std; #define mem(a) memset(a, 0, sizeof(a)) #define dbg(x) cout << #x << " = " << x << endl #define ll long long //不要再爆long long了!!!!!!!!不要再爆long long了!!!!!!! int main() { int k; cin >> k; int cnt = 1; if (k % 2 == 0 || k % 5 == 0) puts("-1"); else { int n = 7...
#include <bits/stdc++.h> using namespace std; #define mem(a) memset(a, 0, sizeof(a)) #define dbg(x) cout << #x << " = " << x << endl #define ll long long //不要再爆long long了!!!!!!!!不要再爆long long了!!!!!!! int main() { int k; cin >> k; int cnt = 1; if (k % 2 == 0 || k % 5 == 0) puts("-1"); else { int n = 7...
[["-", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
101
k=int (input()) f=-1 a=7 for i in range(1000000): a=(a*10+7)%k if a==0: f=i+2 break if k==7: f=1 print(f)
k=int (input()) f=-1 a=7 for i in range(1000000): a=(a*10+7)%k if a==0: f=i+2 break if k==7 or k==1: f=1 print(f)
[["+", 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
57
#include <bits/stdc++.h> typedef long long ll; using namespace std; const int inf = 1000000007; int main() { int k; scanf("%d", &k); int z = 7, ji = 0; while (ji <= 1000000) { ji++; if (z % k == 0) { break; } z = z * 10 + 7; } if (ji > 1000000) { ji = -1; } printf("%d\n", j...
#include <bits/stdc++.h> typedef long long ll; using namespace std; const int inf = 1000000007; int main() { int k; scanf("%d", &k); int z = 7, ji = 0; while (ji <= 1000000) { ji++; z = z % k; if (z == 0) { break; } z = z * 10 + 7; } if (ji > 1000000) { ji = -1; } print...
[["-", 8, 9, 0, 52, 8, 9, 0, 57, 0, 121], ["-", 0, 52, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 52, 8, 9, 0, 57, 0, 121], ["+", 0, 52, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51...
1
101
import sys def input(): return sys.stdin.readline().strip() def mapint(): return map(int, input().split()) sys.setrecursionlimit(10**9) K = int(input()) cnt = 0 now = 0 if K%2==0: print(-1) exit() s = set([0]) for _ in range(10**6+5): now += pow(10, cnt, K)*7 now %= K if now in s: print(cnt...
import sys def input(): return sys.stdin.readline().strip() def mapint(): return map(int, input().split()) sys.setrecursionlimit(10**9) K = int(input()) cnt = 0 now = 0 if K%2==0: print(-1) exit() s = set([0]) for _ in range(10**6+5): now += pow(10, cnt, K)*7 now %= K if now==0: print(cnt+1...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 267], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
135
#include <algorithm> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <time.h> #include <vector> using namespace std; #define rep(i, a, n) fo...
#include <algorithm> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <time.h> #include <vector> using namespace std; #define rep(i, a, n) fo...
[["-", 12, 16, 12, 2, 3, 4, 0, 23, 0, 24], ["-", 12, 2, 3, 4, 0, 23, 0, 16, 17, 72], ["-", 12, 2, 3, 4, 0, 23, 0, 16, 12, 13], ["-", 12, 16, 12, 2, 3, 4, 0, 23, 0, 25]]
1
512
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); long k = scan.nextLong(); long count = 1; long seven = 7; if (k % 2 == 0) { System.out.println(-1); } else { while (count < 1000000) { if (seven %...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); long k = scan.nextLong(); long count = 1; long seven = 7; if (k % 2 == 0) { System.out.println(-1); } else { while (count < 1000000) { if (seven %...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 75, 196, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 75, 196, 0, 1, 0, 11, 12, 16, 12, 22]]
3
135
#include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <utility> #include <vector> #define rep(i, n) for (int i = ...
#include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <utility> #include <vector> #define rep(i, n) for (int i = ...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25]]
1
385
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) K = int(input()) if K % 2 == 0 or K % 5 == 0: print(-1) return True ans = 1 K1 = K % 10 t = K while t: # print(ans) for i in range(10): if (t + K1 * i) % 10 == 7...
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) K = int(input()) if K % 2 == 0 or K % 5 == 0: print(-1) return True ans = 0 K1 = K % 10 t = K while t: # print(ans) for i in range(10): if (t + K1 * i) % 10 == 7...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612]]
5
128
#include <bits/stdc++.h> using namespace std; // a^n mod を計算する long long modpow(long long a, long long n, long long mod) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } int main() { int K; cin >> K; if (K % 2 == 0 || K % 5...
#include <bits/stdc++.h> using namespace std; // a^n mod を計算する long long modpow(long long a, long long n, long long mod) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } int main() { int K; cin >> K; if (K % 2 == 0 || K % 5...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
150
k = int(input()) m = 7 if(k%2==0): print("-1") else: i = 1 while True: m = m%k if(j==0): print(i) break if(i>k): print("-1") break m *= 10 m += 7 i += 1
k = int(input()) m = 7 if(k%2==0): print("-1") else: i = 1 while True: m = m%k if(m==0): print(i) break if(i>k): print("-1") break m *= 10 m += 7 i += 1
[["-", 8, 196, 0, 57, 15, 23, 0, 666, 0, 22], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 0, 22]]
5
74
k=int(input()) n=0 a=0 ss=0 if k%7==0: print(1) elif k%2==0: print(-1) elif k%5==0: print(-1) else: while a==0: n+=1 ss=10*(ss%k)+1 if ss%k==0: a=1 if a==1: print(n) else: print(-1)
k=int(input()) n=0 a=0 ss=0 if k==7: print(1) elif k%2==0: print(-1) elif k%5==0: print(-1) else: while a==0: n+=1 ss=10*(ss%k)+7 if ss%k==0: a=1 if a==1: print(n) else: print(-1)
[["-", 0, 656, 0, 57, 15, 666, 0, 657, 17, 109], ["-", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
99
k = int(input()) if k % 2 == 0 or k % 5 == 0: print(-1) exit() r = 0 for i in range(1, k//2): r = (r * 10 + 7) % k if r == 0: print(i) break else: print(k-1)
k = int(input()) if k % 2 == 0 or k % 5 == 0: print(-1) exit() r = 0 for i in range(1, k+1): r = (r * 10 + 7) % k if r == 0: print(i) break else: print(-1)
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 676], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22]]
5
73
k = int(input()) if k % 2 == 0: print("-1") exit() if k == 1 or k == 7: print("-1") exit() seven_i = 7 for i in range(1,10**6): seven_i = seven_i*10+7 seven_mod = seven_i % k if seven_mod == 0: print(i+1) exit() seven_i = seven_mod print("-1")
k = int(input()) if k % 2 == 0: print("-1") exit() if k == 1 or k == 7: print("1") exit() seven_i = 7 for i in range(1,10**6): seven_i = seven_i*10+7 seven_mod = seven_i % k if seven_mod == 0: print(i+1) exit() seven_i = seven_mod print("-1")
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
92
#include <bits/stdc++.h> using namespace std; using ll = long long; #define itn int #define rep(i, n) for (int i = 0; i < n; i++) #define rep2(i, a, n) for (int i = (a); i < (n); i++) using P = pair<int, int>; int main(void) { ll k; cin >> k; ll alina = -1; if (k % 2 == 0 || k % 5 == 0) cout << alina << e...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define itn int #define rep(i, n) for (int i = 0; i < n; i++) #define rep2(i, a, n) for (int i = (a); i < (n); i++) using P = pair<int, int>; int main(void) { ll k; cin >> k; ll alina = -1; if (k % 2 == 0 || k % 5 == 0) cout << alina << e...
[["+", 0, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 12, 22], ["-", 0, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["-", 0, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 0, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13]]
1
140
import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 0 ;count = 0 ;pro = 1 k = int(input()) d = 7 % k for i in range(1, k+10): if d == 0: ans = i break d = (10*d + 7) % k prin...
import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 0 ;count = 0 ;pro = 1 k = int(input()) ans = -1 d = 7 % k for i in range(1, k+10): if d == 0: ans = i break d = (10*d + 7)...
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 0, 656, 0, 1, 0, 662, 12, 664, 17, 33], ["+", 0, 656, 0, 1, 0, 662, 12, 664, 28, 612]]
5
114
k=int(input()) if k==1 or k==7: print(1) ans = 1 amari = 7%k s = amari for i in range(k): ans += 1 amari = amari*10 % k s += amari s %= k if s==0: print(ans) exit() print(-1)
k=int(input()) if k==1 or k==7: print(1) exit() ans = 1 amari = 7%k s = amari for i in range(k): ans += 1 amari = amari*10 % k s += amari s %= k if s==0: print(ans) exit() print(-1)
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
73
a=7 ans=1 k=int(input()) a%=k if a==0: print(ans) for i in range(k): a=(a*10+7)%k ans+=1 if a==0: print(ans) exit() print(-1)
a=7 ans=1 k=int(input()) a%=k if a==0: print(ans) exit() for i in range(k): a=(a*10+7)%k ans+=1 if a==0: print(ans) exit() print(-1)
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
65
#ifndef TEMPLATE_HPP #define TEMPLATE_HPP #include <algorithm> #include <bitset> #include <cmath> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <memory> #include <numeric> #include <set> #include <string> #include <tuple> #inc...
#ifndef TEMPLATE_HPP #define TEMPLATE_HPP #include <algorithm> #include <bitset> #include <cmath> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <memory> #include <numeric> #include <set> #include <string> #include <tuple> #inc...
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 48]]
1
4,176
#include <bits/stdc++.h> using namespace std; // conversion //------------------------------------------ inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } template <class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } // math //--------...
#include <bits/stdc++.h> using namespace std; // conversion //------------------------------------------ inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } template <class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } // math //--------...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 108], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132]]
1
1,182
#include <algorithm> #include <bitset> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; vector<int> factor(int mod_K) { vector<int> list(1000009); list[0] = 7; for (int i = 1; i <= 1000000; i++) { list[i] = (10 * li...
#include <algorithm> #include <bitset> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; vector<int> factor(int mod_K) { vector<int> list(1000009); list[0] = 7 % mod_K; for (int i = 1; i <= 1000000; i++) { list[i] = ...
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
163
# def div(n): # ans = [] # for i in range(1,int(n**(1/2)+2)): # if n%i == 0: # ans.append(i) # ans.append(n//i) # ans = set(ans) # return ans k = int(input()) # print(div(k)) a = 1 for i in range(1,10**7+2): if a%k == 0: print(i) exit() a=a*10+1 ...
# def div(n): # ans = [] # for i in range(1,int(n**(1/2)+2)): # if n%i == 0: # ans.append(i) # ans.append(n//i) # ans = set(ans) # return ans k = int(input()) # print(div(k)) a = 7 for i in range(1,10**7+2): if a%k == 0: print(i) exit() a=a*10+7 ...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
64
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, a, b) for (ll i = (a); i < (b); i++) #define REP(i, n) rep(i, 0, n) void solve() { int n; cin >> n; int f = 0; REP(i, 2000000) { f = (f * 10 + 7) % n; if (!f) { cout << i << endl; return; } } cout << ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, a, b) for (ll i = (a); i < (b); i++) #define REP(i, n) rep(i, 0, n) void solve() { int n; cin >> n; int f = 0; REP(i, 2000000) { f = (f * 10 + 7) % n; if (!f) { cout << i + 1 << endl; return; } } cout...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
116
// Copyright 2020 yaito3014 #include <iostream> #include <set> int main() { int K; std::cin >> K; std::set<int> s; int ans = -1; long long j = 7; for (int i = 0;; ++i, j = (j * 10 + 7) % K) { if (j == 0) { ans = i + 1; break; } if (s.find(j) != s.end()) break; s.insert(j);...
// Copyright 2020 yaito3014 #include <iostream> #include <set> int main() { int K; std::cin >> K; std::set<int> s; int ans = -1; long long j = 7 % K; for (int i = 0;; ++i, j = (j * 10 + 7) % K) { if (j == 0) { ans = i + 1; break; } if (s.find(j) != s.end()) break; s.insert...
[["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
114
k = int(input()) mod = 0 for i in range(1, k): mod = ((mod * 10) + 7) % k if mod == 0: print(i) exit() print(-1)
k = int(input()) mod = 0 for i in range(1, 10**6): mod = ((mod * 10) + 7) % k if mod == 0: print(i) exit() print(-1)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 578], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
51
K = int(input()) ans = 1 X = 7 cnt = K while(cnt > 0): # print('rem={}'.format(X%K)) rem = X % K if rem == 0: print(ans) break else: remlst.append(rem) ans += 1 X = rem*10 + 7 cnt -= 1 if rem != 0: print(-1)
K = int(input()) ans = 1 X = 7 cnt = K while(cnt > 0): # print('rem={}'.format(X%K)) rem = X % K if rem == 0: print(ans) break else: ans += 1 X = rem*10 + 7 cnt -= 1 if rem != 0: print(-1)
[["-", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["-", 8, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["-", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
71
#include <bits/stdc++.h> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) using namespace std; template <class T> using vec = std::vector<T>; typedef long long ll; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } tem...
#include <bits/stdc++.h> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) using namespace std; template <class T> using vec = std::vector<T>; typedef long long ll; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } tem...
[["+", 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
305
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; ll GetDigit(ll num) { return log10(num) + 1; } // numの桁数を求める int main() { ll k; cin >> k; ll ans = 1; ll na = 1; if (k == 7 || k == 1) { cout << 1 << endl; return 0; } rep(i, 1...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; ll GetDigit(ll num) { return log10(num) + 1; } // numの桁数を求める int main() { ll k; cin >> k; ll ans = 1; ll na = 7; if (k == 1 || k == 7) { cout << 1 << endl; return 0; } rep(i, 1...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["-", 8, 9, 0, 9, 0, 1, 0, 11, 12, 13], ["+",...
1
133
/* _ __ _ _____ _____ _____ ___ _ _| |__ ___ / _|_ __ ___ __ _| | __ |___ |___ |___ | / __| | | | '_ \ / _ \ |_| '__/ _ \/ _` | |/ / / / / / / / | (__| |_| | |_) | __/ _| | | __/ (_| | < / / / / / / \___|\__,_|_.__/ \___|_| |_| \___|\__,_|_|\_\ ...
/* _ __ _ _____ _____ _____ ___ _ _| |__ ___ / _|_ __ ___ __ _| | __ |___ |___ |___ | / __| | | | '_ \ / _ \ |_| '__/ _ \/ _` | |/ / / / / / / / | (__| |_| | |_) | __/ _| | | __/ (_| | < / / / / / / \___|\__,_|_.__/ \___|_| |_| \___|\__,_|_|\_\ ...
[["-", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 22]]
1
1,681
#include <bits/stdc++.h> using namespace std; int read() { int x; scanf("%d", &x); return x; } const int maxn = 3e5 + 10; const int INF = 1e9; int mod = 1e9 + 7; using namespace std; int S(int K) { if (K == 7) return 1; vector<bool> r(K, false); int c = 7, len = 1; r[c] = true; while (1) { c = ...
#include <bits/stdc++.h> using namespace std; int read() { int x; scanf("%d", &x); return x; } const int maxn = 3e5 + 10; const int INF = 1e9; int mod = 1e9 + 7; using namespace std; int S(int K) { if (K == 7 || K == 1) return 1; vector<bool> r(K, false); int c = 7, len = 1; r[c] = true; while (1) ...
[["+", 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
169
def main(): k = int(input()) kint = 7 % k before = 7 % k if k == 1 and k == 7: print(1) exit() for i in range(k): x = (before * 10) % k before = x kint += x kint = kint % k if kint % k == 0: print(i + 2) exit() print(-1) if __name__ == '__main__': main()
def main(): k = int(input()) kint = 7 % k before = 7 % k if k == 1 or k == 7: print(1) exit() for i in range(k): x = (before * 10) % k before = x kint += x kint = kint % k if kint % k == 0: print(i + 2) exit() print(-1) if __name__ == '__main__': main()
[["-", 0, 14, 8, 196, 0, 57, 15, 679, 17, 355], ["+", 0, 14, 8, 196, 0, 57, 15, 679, 17, 354]]
5
98
#include <bits/stdc++.h> using namespace std; #define int long long #define pi pair<int, int> #define ff first #define ss second #define boost \ ios::sync_with_stdio(false); \ cin.tie(nullptr) #define en...
#include <bits/stdc++.h> using namespace std; #define int long long #define pi pair<int, int> #define ff first #define ss second #define boost \ ios::sync_with_stdio(false); \ cin.tie(nullptr) #define en...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
120
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll k; int main() { cin >> k; if (k == 7) { printf("1"); return 0; } if (k % 2 == 0 || k % 5 == 0) { printf("-1"); return 0; } if (k % 7 == 0) k /= 7; int r = 1, cnt = 1; while (r != 0) { r = (r * 10 + 1) % k; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll k; int main() { cin >> k; if (k == 7 || k == 1) { printf("1"); return 0; } if (k % 2 == 0 || k % 5 == 0) { printf("-1"); return 0; } if (k % 7 == 0) k /= 7; int r = 1, cnt = 1; while (r != 0) { r = (r * 10 +...
[["+", 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
121
#include <bits/stdc++.h> using namespace std; int main() { int K; int ans; int digit = 0; int quotient; int seven = 0; int remaind = 0; cin >> K; quotient = K; if ((K % 2 == 0 or K % 5 == 0) and !(K % 7 == 0)) { cout << "-1" << endl; } else { while (quotient > 1) { quotient = quotien...
#include <bits/stdc++.h> using namespace std; int main() { int K; int ans; int digit = 0; int quotient; int seven = 0; int remaind = 0; cin >> K; quotient = K; if ((K % 2 == 0 or K % 5 == 0) and !(K % 7 == 0)) { cout << "-1" << endl; } else { while (quotient >= 1) { quotient = quotie...
[["-", 0, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["+", 0, 9, 0, 52, 15, 339, 51, 16, 17, 20]]
1
171
#include <algorithm> #include <bits/stdc++.h> #include <string> #include <vector> using namespace std; vector<string> split(const string &s, char delim) { vector<string> elems; string item; for (char ch : s) { if (ch == delim) { if (!item.empty()) { elems.push_back(item); } item.cl...
#include <algorithm> #include <bits/stdc++.h> #include <string> #include <vector> using namespace std; vector<string> split(const string &s, char delim) { vector<string> elems; string item; for (char ch : s) { if (ch == delim) { if (!item.empty()) { elems.push_back(item); } item.cl...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
923
#include <iostream> using namespace std; int main() { long long n; cin >> n; if (n % 7 == 0) n %= 7; if ((n % 2 == 0) || (n % 5 == 0)) { cout << "-1" << endl; return 0; } if (n == 1) { cout << "1" << endl; return 0; } int answer = 1; long long nowMod = 1; long long totalMo...
#include <iostream> using namespace std; int main() { long long n; cin >> n; if (n % 7 == 0) n /= 7; if ((n % 2 == 0) || (n % 5 == 0)) { cout << "-1" << endl; return 0; } if (n == 1) { cout << "1" << endl; return 0; } int answer = 1; long long nowMod = 1; long long totalMod...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 132], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 90]]
1
138
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <string.h> #include <vector> using namespace std; long long X, D, N, Y, ans, i, j, K, r; int main() { cin >> K; r = 7; for (i = 1; i < K; i++) { r = r % K; if (r == 0) { cout << i...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <string.h> #include <vector> using namespace std; long long X, D, N, Y, ans, i, j, K, r; int main() { cin >> K; r = 7; for (i = 1; i < 10000000; i++) { r = r % K; if (r == 0) { co...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
105
K=int(input()) if K%2==0 or K%5==0: print(-1) exit() elif K==7: print(1) else: M=7%K B=7%K for i in range(10**7): A=((B*10)%K) M+=A M%=K if M==0: print(i+2) exit() B=A+0 #print(M,B,i)
K=int(input()) if K%2==0 or K%5==0: print(-1) exit() elif K==7 or K==1: print(1) else: M=7%K B=7%K for i in range(10**7): A=((B*10)%K) M+=A M%=K if M==0: print(i+2) exit() B=A+0 #print(M,B,i)
[["+", 0, 656, 0, 57, 75, 665, 15, 679, 17, 354], ["+", 0, 57, 75, 665, 15, 679, 12, 666, 0, 22], ["+", 0, 57, 75, 665, 15, 679, 12, 666, 667, 60], ["+", 0, 57, 75, 665, 15, 679, 12, 666, 0, 612]]
5
97
K=49 def solve(K): f=0 from collections import defaultdict if K==1: return 1 elif K%2==0 or K%5==0: return -1 if K%7==0: if K==7: return 1 else: f=1 K=K//7 app = defaultdict(lambda: False) broken=False for n in ra...
K=int(input()) def solve(K): f=0 from collections import defaultdict if K==1: return 1 elif K%2==0 or K%5==0: return -1 if K%7==0: if K==7: return 1 else: f=1 K=K//7 app = defaultdict(lambda: False) broken=False f...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
198
#!/usr/bin/python # -*- coding: utf-8 -*- # def def int_mtx(N): x = [] for _ in range(N): x.append(list(input())) return x def int_map(): return map(int,input().split()) def int_list(): return list(map(int,input().split())) def print_space(l): return print(" ".join([str(x) for x in ...
#!/usr/bin/python # -*- coding: utf-8 -*- # def def int_mtx(N): x = [] for _ in range(N): x.append(list(input())) return x def int_map(): return map(int,input().split()) def int_list(): return list(map(int,input().split())) def print_space(l): return print(" ".join([str(x) for x in ...
[["+", 0, 656, 0, 57, 15, 666, 0, 657, 31, 612], ["+", 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
185
#include <bits/stdc++.h> using namespace std; #define rep(i, m, n) for (int(i) = (int)(m); i < (int)(n); ++i) #define rep2(i, m, n) for (int(i) = (int)(n)-1; i >= (int)(m); --i) #define REP(i, n) rep(i, 0, n) #define REP2(i, n) rep2(i, 0, n) #define all(hoge) (hoge).begin(), (hoge).end() #define en '\n' using ll = lon...
#include <bits/stdc++.h> using namespace std; #define rep(i, m, n) for (int(i) = (int)(m); i < (int)(n); ++i) #define rep2(i, m, n) for (int(i) = (int)(n)-1; i >= (int)(m); --i) #define REP(i, n) rep(i, 0, n) #define REP2(i, n) rep2(i, 0, n) #define all(hoge) (hoge).begin(), (hoge).end() #define en '\n' using ll = lon...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 8, 9, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 9, 0, 1,...
1
479
#include <cstdio> #include <iostream> using namespace std; int n, d; int main() { cin >> n; for (int i = 1; i < n; i++) { d = (d * 10 + 7) % n; if (d == 0) { printf("%d\n", i); return 0; } } printf("-1\n"); return 0; }
#include <cstdio> #include <iostream> using namespace std; int n, d; int main() { cin >> n; for (int i = 1; i <= n; i++) { d = (d * 10 + 7) % n; if (d == 0) { printf("%d\n", i); return 0; } } printf("-1\n"); return 0; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
83
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) using namespace std; int main() { int K; cin >> K; int hoge = 7; int sum = 0; for (int i = 0; i < K * 5; i++) { hoge = (hoge % K); sum++; if (hoge == 0) break; hoge = hoge * 10 + 7; } if (sum == K) sum...
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) using namespace std; int main() { int K; cin >> K; int hoge = 7; int sum = 0; for (int i = 0; i < K * 5; i++) { hoge = (hoge % K); sum++; if (hoge == 0) break; hoge = hoge * 10 + 7; } if (sum == K * 5) ...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 48], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
101
K = int(input()) #偶数は弾く if K % 2 == 0: print(-1) r = 0 for i in range(1, 10**6): r = (10 * r + 7) % K if r % K == 0: print(i) break else: print(-1)
K = int(input()) # k_keta = len(str(K)) # print(k_keta) #偶数は弾く if K % 2 == 0: print(-1) exit() r = 0 for i in range(1, 10**6): #何回目のループか r = (10 * r + 7) % K if r % K == 0: print(i) break else: print(-1)
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
66
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)n; ++i) #define REP(i, a, b) for (int i = int(a); i < (int)b; ++i) #define Graph vector<vecctor<ll>> #define pairs vector<pair<ll, ll>> #define pb push_back using namespace std; using ll = long long; const ll INF = 1e18; const double PI = acos(-1); t...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)n; ++i) #define REP(i, a, b) for (int i = int(a); i < (int)b; ++i) #define Graph vector<vecctor<ll>> #define pairs vector<pair<ll, ll>> #define pb push_back using namespace std; using ll = long long; const ll INF = 1e18; const double PI = acos(-1); t...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22]]
1
269
#include <cstdio> #include <iostream> using namespace std; int main() { int k; int negative_output = -1; int digit_count = 0; int divide_round_timer = 0; int divide_number; cin >> k; int digit_count_temp = k; while (digit_count_temp > 0) { digit_count_temp = digit_count_temp / 10; digit_count++;...
#include <cstdio> #include <iostream> using namespace std; int main() { int k; int negative_output = -1; int digit_count = 0; int divide_round_timer = 0; int divide_number; cin >> k; int digit_count_temp = k; while (digit_count_temp > 0) { digit_count_temp = digit_count_temp / 10; digit_count++;...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35], ["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 46]]
1
149
K = int(input()) if K % 2 == 0 or K % 5 == 0: print(-1) elif K % 7 == 0: K = K // 7 else: j = 1 while True: if pow(10, j, K*9) == 1: print(j) break else: j += 1
K = int(input()) if K % 2 == 0 or K % 5 == 0: print(-1) else: if K % 7 == 0: K = K // 7 j = 1 while True: if pow(10, j, K*9) == 1: print(j) break else: j += 1
[["-", 36, 36, 0, 656, 0, 57, 75, 665, 0, 683], ["+", 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, 57, 0, 121], ["-", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["-", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102]]
5
70
K = int(input()) if K % 2 == 0 or K % 5 == 0: print(-1) else: p = 0 for i in range(K): p = ((p * 10) % K + 1) % K if p == 0: print(i + 1) break
K = int(input()) if K % 2 == 0 or K % 5 == 0: print(-1) else: p = 0 for i in range(K): p = ((p * 10) % K + 7) % K if p == 0: print(i + 1) break
[["-", 0, 662, 12, 657, 31, 23, 0, 657, 12, 612], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 12, 612]]
5
66
#include <bits/stdc++.h> using namespace std; int main() { int K; cin >> K; int ans = -1; int mod = 7777777 % K; int amari = 70000000 % K; if (K == 7) ans = 1; else if (77 % K == 0) ans = 2; else if (777 % K == 0) ans = 3; else if (7777 % K == 0) ans = 4; else if (77777 % K == 0) ...
#include <bits/stdc++.h> using namespace std; int main() { int K; cin >> K; int ans = -1; int mod = 7777777 % K; int amari = 70000000 % K; if (7 % K == 0) ans = 1; else if (77 % K == 0) ans = 2; else if (777 % K == 0) ans = 3; else if (7777 % K == 0) ans = 4; else if (77777 % K ==...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
197
import java.io.*; import java.util.*; public class Main { private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); private static final PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); private static StringTokenizer st; ...
import java.io.*; import java.util.*; public class Main { private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); private static final PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); private static StringTokenizer st; ...
[["-", 0, 57, 15, 15, 0, 16, 31, 16, 17, 85], ["+", 0, 57, 15, 15, 0, 16, 31, 16, 17, 109]]
3
227
#include <bits/stdc++.h> using namespace std; int main() { long long x; cin >> x; long long cur = 7; int ans = 1; while (cur != 0 and ans < 1e8) { cur = (cur * 10 + 7) % x; ans++; } if (ans == 1e8) cout << "-1\n"; else cout << ans << "\n"; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long x; cin >> x; long long cur = 7 % x; int ans = 1; while (cur != 0 and ans < 1e8) { cur = (cur * 10 + 7) % x; ans++; } if (ans == 1e8) cout << "-1\n"; else cout << ans << "\n"; return 0; }
[["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
83
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < n; i++) #define repl(i, l, r) for (ll i = (l); i < (r); i++) #define per(i, n) for (ll i = n - 1; i >= 0; i--) #define perl(i, r, l) for (ll i = r - 1; i >= l; i--) #define fi first #define se second #define pb push_back #define ins inse...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < n; i++) #define repl(i, l, r) for (ll i = (l); i < (r); i++) #define per(i, n) for (ll i = n - 1; i >= 0; i--) #define perl(i, r, l) for (ll i = r - 1; i >= l; i--) #define fi first #define se second #define pb push_back #define ins inse...
[["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 22], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 22]]
1
1,834
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pa pair<int, int> #define pal pair<long long, long long> #define pali pair<long long, int> #define pad pair<double, double> #define pb push_back #define mp make_pair #define COUT(v) ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pa pair<int, int> #define pal pair<long long, long long> #define pali pair<long long, int> #define pad pair<double, double> #define pb push_back #define mp make_pair #define COUT(v) ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
1,216
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll K; cin >> K; if (K & 7 == 0) { K = K / 7; } if (7 % K == 0) { cout << 1 << endl; } else { ll sum = 0, d = 1, y = 1; rep(i, 10 * K) { ...
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll K; cin >> K; if (K % 7 == 0) { K = K / 7; } if (7 % K == 0) { cout << 1 << endl; } else { ll sum = 0, d = 1, y = 1; rep(i, 10 * K) { ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 67], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109]]
1
156
/* Simplicity and Goodness */ #include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; using namespace std; // typedef tree<int, null_type, less<int>, rb_tree_tag, // tree_order_statistics_node_update> indexed_set; void my...
/* Simplicity and Goodness */ #include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; using namespace std; // typedef tree<int, null_type, less<int>, rb_tree_tag, // tree_order_statistics_node_update> indexed_set; void my...
[["-", 0, 7, 15, 16, 12, 16, 31, 74, 51, 13], ["+", 0, 7, 15, 16, 12, 16, 31, 74, 51, 13], ["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
374
// abc174_c #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include...
// abc174_c #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include...
[["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
366
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i, a, b) for (int i = (a); i < (b); ++i) using namespace std; typedef long long ll; typedef pair<int, int> P; int main() { int k; cin >> k; bool flag = false; ll l = (k % 7 == 0) ? 9 * k / l : 9 * k; ll n = 1; for (ll i ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i, a, b) for (int i = (a); i < (b); ++i) using namespace std; typedef long long ll; typedef pair<int, int> P; int main() { int k; cin >> k; bool flag = false; ll l = (k % 7 == 0) ? 9 * k / 7 : 9 * k; ll n = 1; for (ll i ...
[["-", 0, 43, 49, 50, 51, 41, 64, 16, 12, 22], ["+", 0, 43, 49, 50, 51, 41, 64, 16, 12, 13]]
1
144
#include <iostream> #include <math.h> #include <stdio.h> #include <string> using namespace std; int main() { int K; cin >> K; int seven = 7 % K; for (int i = 0; i <= K; i++) { if (seven == 0) { cout << i << endl; return 0; } seven = (seven * 10 + 7) % K; } cout << -1 << endl; re...
#include <iostream> #include <math.h> #include <stdio.h> #include <string> using namespace std; int main() { int K; cin >> K; int seven = 7 % K; for (int i = 1; i <= K; i++) { if (seven == 0) { cout << i << endl; return 0; } seven = (seven * 10 + 7) % K; } cout << -1 << endl; re...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
86
#include <bits/stdc++.h> using namespace std; typedef long long ll; //ループ #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll i = n - 1; i >= 0; i--) #define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++) #define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--) //コンテナ #define ALL(x) (x).begin(...
#include <bits/stdc++.h> using namespace std; typedef long long ll; //ループ #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll i = n - 1; i >= 0; i--) #define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++) #define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--) //コンテナ #define ALL(x) (x).begin(...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 17, 33], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 12, 22]]
1
665
#include <algorithm> #include <array> #include <iostream> #include <numeric> #include <string> #include <tuple> #include <vector> using namespace std; using ll = long long; #define rep(i, n) for (decltype(n) i = 0; i < n; ++i) inline constexpr ll Inf = (1ULL << 62) - 1; template <class T> void updatemax(T &a, T b) { ...
#include <algorithm> #include <array> #include <iostream> #include <numeric> #include <string> #include <tuple> #include <vector> using namespace std; using ll = long long; #define rep(i, n) for (decltype(n) i = 0; i < n; ++i) inline constexpr ll Inf = (1ULL << 62) - 1; template <class T> void updatemax(T &a, T b) { ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
180
// // main.cpp // 1234 // // Created by Moha Jain on 14/04/20. // Copyright © 2020 Moha Jain. All rights reserved. // #include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordere...
// // main.cpp // 1234 // // Created by Moha Jain on 14/04/20. // Copyright © 2020 Moha Jain. All rights reserved. // #include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordere...
[["+", 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
155
#include <algorithm> #include <bitset> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <set> #include <string> #include <vector> #define db double #define vi vector<int> #define pb push_back #define fi first #define se second #define ll long long #define ld long doubl...
#include <algorithm> #include <bitset> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <set> #include <string> #include <vector> #define db double #define vi vector<int> #define pb push_back #define fi first #define se second #define ll long long #define ld long doubl...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
326
#include <bits/stdc++.h> #define ll int #define ld long double #define mod 1000000007 #define pb push_back #define ff first #define ss second #define mp make_pair #define all(x) x.begin(), x.end() #define fastio \ ios_base::sync_with_stdio(false); ...
#include <bits/stdc++.h> #define ll int #define ld long double #define mod 1000000007 #define pb push_back #define ff first #define ss second #define mp make_pair #define all(x) x.begin(), x.end() #define fastio \ ios_base::sync_with_stdio(false); ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
132
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll k, ans = -1, s = 7, t = 1; cin >> k; for (int i = 1; i < k; i++) { s %= k; if (s == 0) { ans = i; break; } s = s * 10 + 7; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll k, ans = -1, s = 7, t = 1; cin >> k; for (int i = 1; i <= k; i++) { s %= k; if (s == 0) { ans = i; break; } s = s * 10 + 7; } cout << ans << endl; return 0; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
87
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vl; typedef vector<vl> vvl; typedef pair<ll, ll> pll; typedef vector<bool> vb; const ll oo = 0x3f3f3f3f3f3f3f3f; const double eps = 1e-9; #define sz(c) ll((c).size()) #define all(c) begin(c), end(c) #define FOR(i, a, b) for (ll i = ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vl; typedef vector<vl> vvl; typedef pair<ll, ll> pll; typedef vector<bool> vb; const ll oo = 0x3f3f3f3f3f3f3f3f; const double eps = 1e-9; #define sz(c) ll((c).size()) #define all(c) begin(c), end(c) #define FOR(i, a, b) for (ll i = ...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
187
k = int(input()) if k%2==0 or k%5==0: print('-1') else: a = 0 for i in range(99983): a = (a*10+7) % k if a == 0: print(i+1) break else: print(-1)
k = int(input()) if k%2==0 or k%5==0: print('-1') else: a = 0 for i in range(999983): a = (a*10+7) % k if a == 0: print(i+1) break else: print(-1)
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
70
k = int(input()) def f(k): sevens=0 for i in range(1, k): sevens = (sevens*10+7) % k if sevens == 0: return i return -1 print(f(k))
k = int(input()) def f(k): sevens=0 for i in range(1, k+1): sevens = (sevens*10+7) % k if sevens == 0: return i return -1 print(f(k))
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
55