mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 18:48:48 +00:00
parent
20be6494c0
commit
920fb9b724
@ -1,11 +1,68 @@
|
||||
#include <bits/stdc++.h>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
using namespace std;
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
int n, l, r;
|
||||
const int T = 2e5 + 5,
|
||||
N = 1e7 + 5;
|
||||
|
||||
int t, x, ans[T];
|
||||
bool f[N];
|
||||
std::pair<int, int> q[T];
|
||||
|
||||
bool has7(int x) {
|
||||
while (x) {
|
||||
if (x % 10 == 7) return true;
|
||||
x /= 10;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int main() {
|
||||
cin >> n >> l >> r;
|
||||
cout << min((int)(ceil(1.0 * l / n) * n + n - 1), r) % n << endl;
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> t;
|
||||
|
||||
for (int i = 7; i <= 10000000; i += 7) {
|
||||
f[i] = true;
|
||||
}
|
||||
|
||||
for (int i = 1; i <= 10000000; i++) {
|
||||
if (has7(i)) {
|
||||
for (int j = 1; i * j <= 10000000; j++) {
|
||||
f[i * j] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < t; i++) {
|
||||
cin >> q[i].first;
|
||||
|
||||
q[i].second = i;
|
||||
}
|
||||
|
||||
std::sort(q, q + t);
|
||||
|
||||
for (int i = 0, j = 1; i < t; i++) {
|
||||
if (f[q[i].first]) {
|
||||
ans[q[i].second] = -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
while (j <= q[i].first) j++;
|
||||
while (j <= 10000000 && f[j]) j++;
|
||||
|
||||
ans[q[i].second] = j;
|
||||
}
|
||||
|
||||
for (int i = 0; i < t; i++) {
|
||||
cout << ans[i] << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
BIN
S2OJ/1118/data/candy1.in
(Stored with Git LFS)
BIN
S2OJ/1118/data/candy1.in
(Stored with Git LFS)
Binary file not shown.
BIN
S2OJ/1118/data/candy1.out
(Stored with Git LFS)
BIN
S2OJ/1118/data/candy1.out
(Stored with Git LFS)
Binary file not shown.
BIN
S2OJ/1118/data/candy10.in
(Stored with Git LFS)
BIN
S2OJ/1118/data/candy10.in
(Stored with Git LFS)
Binary file not shown.
BIN
S2OJ/1118/data/candy10.out
(Stored with Git LFS)
BIN
S2OJ/1118/data/candy10.out
(Stored with Git LFS)
Binary file not shown.
BIN
S2OJ/1118/data/candy2.in
(Stored with Git LFS)
BIN
S2OJ/1118/data/candy2.in
(Stored with Git LFS)
Binary file not shown.
BIN
S2OJ/1118/data/candy2.out
(Stored with Git LFS)
BIN
S2OJ/1118/data/candy2.out
(Stored with Git LFS)
Binary file not shown.
BIN
S2OJ/1118/data/candy3.in
(Stored with Git LFS)
BIN
S2OJ/1118/data/candy3.in
(Stored with Git LFS)
Binary file not shown.
BIN
S2OJ/1118/data/candy3.out
(Stored with Git LFS)
BIN
S2OJ/1118/data/candy3.out
(Stored with Git LFS)
Binary file not shown.
BIN
S2OJ/1118/data/candy4.in
(Stored with Git LFS)
BIN
S2OJ/1118/data/candy4.in
(Stored with Git LFS)
Binary file not shown.
BIN
S2OJ/1118/data/candy4.out
(Stored with Git LFS)
BIN
S2OJ/1118/data/candy4.out
(Stored with Git LFS)
Binary file not shown.
BIN
S2OJ/1118/data/candy5.in
(Stored with Git LFS)
BIN
S2OJ/1118/data/candy5.in
(Stored with Git LFS)
Binary file not shown.
BIN
S2OJ/1118/data/candy5.out
(Stored with Git LFS)
BIN
S2OJ/1118/data/candy5.out
(Stored with Git LFS)
Binary file not shown.
BIN
S2OJ/1118/data/candy6.in
(Stored with Git LFS)
BIN
S2OJ/1118/data/candy6.in
(Stored with Git LFS)
Binary file not shown.
BIN
S2OJ/1118/data/candy6.out
(Stored with Git LFS)
BIN
S2OJ/1118/data/candy6.out
(Stored with Git LFS)
Binary file not shown.
BIN
S2OJ/1118/data/candy7.in
(Stored with Git LFS)
BIN
S2OJ/1118/data/candy7.in
(Stored with Git LFS)
Binary file not shown.
BIN
S2OJ/1118/data/candy7.out
(Stored with Git LFS)
BIN
S2OJ/1118/data/candy7.out
(Stored with Git LFS)
Binary file not shown.
BIN
S2OJ/1118/data/candy8.in
(Stored with Git LFS)
BIN
S2OJ/1118/data/candy8.in
(Stored with Git LFS)
Binary file not shown.
BIN
S2OJ/1118/data/candy8.out
(Stored with Git LFS)
BIN
S2OJ/1118/data/candy8.out
(Stored with Git LFS)
Binary file not shown.
BIN
S2OJ/1118/data/candy9.in
(Stored with Git LFS)
BIN
S2OJ/1118/data/candy9.in
(Stored with Git LFS)
Binary file not shown.
BIN
S2OJ/1118/data/candy9.out
(Stored with Git LFS)
BIN
S2OJ/1118/data/candy9.out
(Stored with Git LFS)
Binary file not shown.
BIN
S2OJ/1118/data/ex_number1.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/ex_number1.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/ex_number1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/ex_number1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/ex_number2.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/ex_number2.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/ex_number2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/ex_number2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/ex_number3.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/ex_number3.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/ex_number3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/ex_number3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/ex_number4.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/ex_number4.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/ex_number4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/ex_number4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/number1.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/number1.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/number1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/number1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/number10.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/number10.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/number10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/number10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/number2.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/number2.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/number2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/number2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/number3.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/number3.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/number3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/number3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/number4.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/number4.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/number4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/number4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/number5.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/number5.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/number5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/number5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/number6.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/number6.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/number6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/number6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/number7.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/number7.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/number7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/number7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/number8.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/number8.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/number8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/number8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/number9.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/number9.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/number9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1118/data/number9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1118/data/problem.conf
(Stored with Git LFS)
BIN
S2OJ/1118/data/problem.conf
(Stored with Git LFS)
Binary file not shown.
Loading…
Reference in New Issue
Block a user