QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#96232 | #2919. Subprime | mariam# | AC ✓ | 274ms | 86700kb | C++17 | 2.8kb | 2023-04-13 17:31:31 | 2023-04-13 17:31:34 |
Judging History
answer
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <set>
#include <unordered_set>
#include <queue>
#include <map>
#include <cmath>
#include <climits>
#include <iomanip>
#include <unordered_map>
#include <stdio.h>
#include <stack>
#include <list>
#include "complex"
#include <assert.h>
#define el '\n'
#define ll long long
#define ld long double
using namespace std;
//
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//
//using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
const int N = 1e7 + 5, mod = 1e9 + 7, MAX = 1e9 + 1, M = 1e5;
long double PI = 3.14159265358979323846;;
#define point complex<long double>
#define vec(a, b) b-a
#define dot(a, b) (long double)(conj(a)*b).real()
#define cross(a, b) (long double)(conj(a)*b).imag()
#define length(a) (hypot((a).imag(), (a).real()))
#define angle(a) atan2((a).imag(), (a).real())
int h, w;
//char a[201][201];
//int dx[] = {0, 0, -1, 1, 1, -1, -1, 1}, dy[] = {-1, 1, 0, 0, 1, -1, 1, -1};
//int dx[] = {-1, -1, 0, 0, 1, 1}, dy[] = {-1, 0, -1, 1, 0, 1};
//
//bool valid(int i, int j) {
// return (i < h && i >= 0 && j < w && j >= 0);
//}
//
//bool vis[201][201];
ll mul(ll a, ll b) {
return ((a % mod) * (b % mod)) % mod;
}
ll add(ll a, ll b) {
return ((a % mod) + (b % mod)) % mod;
}
ll sub(ll a, ll b) {
return ((((a + mod) % mod) - ((b + mod) % mod)) + mod) % mod;
}
ll fastpow(ll b, ll p) {
if (p == 0)
return 1;
if (p == 1) {
return b;
}
ll hp = fastpow(b, p / 2);
ll ans = ((hp % mod) * (hp % mod)) % mod;
if (p % 2) {
ans = (ans * b) % mod;
}
return ans % mod;
}
bool prime[N];
int spf[N];
vector<string> p;
void sieve() {
memset(prime, 1, sizeof prime);
prime[0] = prime[1] = 0;
for (int i = 0; i <= N; ++i)
spf[i] = i;
for (int i = 2; i * i <= N; ++i) {
if (!prime[i])continue;
for (int j = i * i; j <= N; j += i) {
prime[j] = 0;
spf[j] = min(spf[j], i);
}
}
for (int i = 2; i < N; ++i) {
if (prime[i])p.push_back(to_string(i));
}
}
void m() {
sieve();
//cout<<p.size()<<'\n';
int l, h;
cin >> l >> h;
l--, h--;
string pp;
cin >> pp;
int cnt = 0;
for (int i = l; i <= h; ++i) {
if (p[i].find(pp) < p[i].size()) {
cnt++;
// cout << p[i] << '\n';
}
}
cout << cnt;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin>>t;
while (t--) {
m();
}
}
详细
Test #1:
score: 100
Accepted
time: 259ms
memory: 85460kb
input:
1 10000 389
output:
45
result:
ok single line: '45'
Test #2:
score: 0
Accepted
time: 223ms
memory: 86700kb
input:
1 100 8
output:
8
result:
ok single line: '8'
Test #3:
score: 0
Accepted
time: 235ms
memory: 85868kb
input:
8000 9000 395
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 222ms
memory: 86168kb
input:
50000 80000 572
output:
63
result:
ok single line: '63'
Test #5:
score: 0
Accepted
time: 225ms
memory: 86416kb
input:
90000 100000 9999
output:
5
result:
ok single line: '5'
Test #6:
score: 0
Accepted
time: 224ms
memory: 85344kb
input:
1 100000 37502
output:
1
result:
ok single line: '1'
Test #7:
score: 0
Accepted
time: 232ms
memory: 85120kb
input:
1 1000 000
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Accepted
time: 245ms
memory: 84636kb
input:
4509 12345 9999
output:
4
result:
ok single line: '4'
Test #9:
score: 0
Accepted
time: 214ms
memory: 85964kb
input:
1 1 2
output:
1
result:
ok single line: '1'
Test #10:
score: 0
Accepted
time: 235ms
memory: 84880kb
input:
2 8 2
output:
0
result:
ok single line: '0'
Test #11:
score: 0
Accepted
time: 235ms
memory: 86356kb
input:
2 9 2
output:
1
result:
ok single line: '1'
Test #12:
score: 0
Accepted
time: 235ms
memory: 84768kb
input:
1 100000 2
output:
44448
result:
ok single line: '44448'
Test #13:
score: 0
Accepted
time: 245ms
memory: 85164kb
input:
1 100000 0
output:
38298
result:
ok single line: '38298'
Test #14:
score: 0
Accepted
time: 241ms
memory: 85208kb
input:
1 100000 00
output:
3384
result:
ok single line: '3384'
Test #15:
score: 0
Accepted
time: 236ms
memory: 86616kb
input:
1 100000 000000
output:
0
result:
ok single line: '0'
Test #16:
score: 0
Accepted
time: 226ms
memory: 86440kb
input:
6 6 13
output:
1
result:
ok single line: '1'
Test #17:
score: 0
Accepted
time: 268ms
memory: 86620kb
input:
19 19 67
output:
1
result:
ok single line: '1'
Test #18:
score: 0
Accepted
time: 232ms
memory: 85784kb
input:
2137 2137 18719
output:
1
result:
ok single line: '1'
Test #19:
score: 0
Accepted
time: 223ms
memory: 86040kb
input:
1 100000 1
output:
65575
result:
ok single line: '65575'
Test #20:
score: 0
Accepted
time: 269ms
memory: 85260kb
input:
1 100000 9
output:
54268
result:
ok single line: '54268'
Test #21:
score: 0
Accepted
time: 258ms
memory: 86536kb
input:
12345 98765 0021
output:
40
result:
ok single line: '40'
Test #22:
score: 0
Accepted
time: 242ms
memory: 86544kb
input:
12345 98765 0201
output:
38
result:
ok single line: '38'
Test #23:
score: 0
Accepted
time: 236ms
memory: 86356kb
input:
12345 98765 2022
output:
21
result:
ok single line: '21'
Test #24:
score: 0
Accepted
time: 223ms
memory: 85400kb
input:
12345 98765 0222
output:
16
result:
ok single line: '16'
Test #25:
score: 0
Accepted
time: 227ms
memory: 85908kb
input:
1 100000 123456
output:
0
result:
ok single line: '0'
Test #26:
score: 0
Accepted
time: 221ms
memory: 86412kb
input:
1 100000 999937
output:
0
result:
ok single line: '0'
Test #27:
score: 0
Accepted
time: 225ms
memory: 85312kb
input:
1 100000 999953
output:
1
result:
ok single line: '1'
Test #28:
score: 0
Accepted
time: 222ms
memory: 85500kb
input:
1 100000 299709
output:
1
result:
ok single line: '1'
Test #29:
score: 0
Accepted
time: 238ms
memory: 86656kb
input:
1 99999 299709
output:
0
result:
ok single line: '0'
Test #30:
score: 0
Accepted
time: 259ms
memory: 85332kb
input:
50000 100000 611953
output:
1
result:
ok single line: '1'
Test #31:
score: 0
Accepted
time: 266ms
memory: 85248kb
input:
50001 100000 611953
output:
0
result:
ok single line: '0'
Test #32:
score: 0
Accepted
time: 227ms
memory: 86020kb
input:
1 100000 12345
output:
8
result:
ok single line: '8'
Test #33:
score: 0
Accepted
time: 232ms
memory: 86544kb
input:
1 100000 2053
output:
46
result:
ok single line: '46'
Test #34:
score: 0
Accepted
time: 240ms
memory: 85568kb
input:
3 5 3
output:
0
result:
ok single line: '0'
Test #35:
score: 0
Accepted
time: 259ms
memory: 84888kb
input:
2 6 3
output:
2
result:
ok single line: '2'
Test #36:
score: 0
Accepted
time: 232ms
memory: 86428kb
input:
1 669 4999
output:
1
result:
ok single line: '1'
Test #37:
score: 0
Accepted
time: 243ms
memory: 85008kb
input:
260 309 003
output:
1
result:
ok single line: '1'
Test #38:
score: 0
Accepted
time: 252ms
memory: 85532kb
input:
1110 1159 151
output:
1
result:
ok single line: '1'
Test #39:
score: 0
Accepted
time: 250ms
memory: 85160kb
input:
145 155 88
output:
3
result:
ok single line: '3'
Test #40:
score: 0
Accepted
time: 241ms
memory: 84628kb
input:
2 99999 0
output:
38297
result:
ok single line: '38297'
Test #41:
score: 0
Accepted
time: 262ms
memory: 84768kb
input:
1911 2000 111
output:
0
result:
ok single line: '0'
Test #42:
score: 0
Accepted
time: 225ms
memory: 84944kb
input:
99960 100000 9709
output:
1
result:
ok single line: '1'
Test #43:
score: 0
Accepted
time: 235ms
memory: 85336kb
input:
1 9 2
output:
2
result:
ok single line: '2'
Test #44:
score: 0
Accepted
time: 243ms
memory: 85848kb
input:
16498 80565 56756
output:
1
result:
ok single line: '1'
Test #45:
score: 0
Accepted
time: 256ms
memory: 86316kb
input:
15975 23849 69814
output:
0
result:
ok single line: '0'
Test #46:
score: 0
Accepted
time: 265ms
memory: 86540kb
input:
21354 64868 3299
output:
23
result:
ok single line: '23'
Test #47:
score: 0
Accepted
time: 260ms
memory: 85824kb
input:
1 100000 129
output:
1284
result:
ok single line: '1284'
Test #48:
score: 0
Accepted
time: 274ms
memory: 85200kb
input:
30521 89695 22212
output:
0
result:
ok single line: '0'
Test #49:
score: 0
Accepted
time: 268ms
memory: 85400kb
input:
1 1 99
output:
0
result:
ok single line: '0'
Test #50:
score: 0
Accepted
time: 261ms
memory: 86488kb
input:
1 9 99
output:
0
result:
ok single line: '0'
Test #51:
score: 0
Accepted
time: 253ms
memory: 85672kb
input:
1 10 9
output:
2
result:
ok single line: '2'
Test #52:
score: 0
Accepted
time: 263ms
memory: 85760kb
input:
500 1000 43
output:
26
result:
ok single line: '26'
Test #53:
score: 0
Accepted
time: 229ms
memory: 86404kb
input:
1 1000 00
output:
10
result:
ok single line: '10'