QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#96215 | #2919. Subprime | mariam# | RE | 4ms | 4152kb | C++17 | 2.8kb | 2023-04-13 17:14:01 | 2023-04-13 17:14:03 |
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 = 1e5 + 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();
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();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 4ms
memory: 4152kb
input:
1 10000 389
output:
45
result:
ok single line: '45'
Test #2:
score: 0
Accepted
time: 4ms
memory: 4080kb
input:
1 100 8
output:
8
result:
ok single line: '8'
Test #3:
score: 0
Accepted
time: 4ms
memory: 4028kb
input:
8000 9000 395
output:
0
result:
ok single line: '0'
Test #4:
score: -100
Runtime Error
input:
50000 80000 572