QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#101294 | #2919. Subprime | men3m | WA | 5ms | 3660kb | C++23 | 1.1kb | 2023-04-29 07:36:46 | 2023-04-29 07:36:48 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long int
const int N = 1e5 + 5, MOD = 1e9 + 7; // 8e7+5
#define nl '\n'
#define rv return void
#define Tests int test_cases; cin >> test_cases; for(int tc=1; tc<=test_cases; tc++)
#define EidMubarak ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
vector<bool> prime(N, true);
vector<int> primes;
void sieve() {
prime[0] = prime[1] = false;
for (int p = 2; p <= N / p; p++) {
if (prime[p]) {
for (int i = p * p; i < N; i += p) {
prime[i] = false;
}
}
}
for (int i = 2; i < N; i++) {
if (prime[i]) {
primes.emplace_back(i);
}
}
}
string s, t;
bool can(int x) {
t = to_string(x);
return (t.find(s) != -1);
}
signed main() {
EidMubarak
// y3ni_mht3dee4();
sieve();
int l, r, ans = 0;
cin >> l >> r >> s;
for (int i = l - 1; i < r; i++)
if (can(primes[i]))
ans++;
cout << ans << nl;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3456kb
input:
1 10000 389
output:
45
result:
ok single line: '45'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3472kb
input:
1 100 8
output:
8
result:
ok single line: '8'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3476kb
input:
8000 9000 395
output:
0
result:
ok single line: '0'
Test #4:
score: -100
Wrong Answer
time: 5ms
memory: 3660kb
input:
50000 80000 572
output:
396
result:
wrong answer 1st lines differ - expected: '63', found: '396'