QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#101294#2919. Subprimemen3mWA 5ms3660kbC++231.1kb2023-04-29 07:36:462023-04-29 07:36:48

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-29 07:36:48]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:3660kb
  • [2023-04-29 07:36:46]
  • 提交

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'