QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#98789 | #2919. Subprime | samynagy | WA | 4ms | 5328kb | C++14 | 1.2kb | 2023-04-20 06:00:23 | 2023-04-20 06:00:27 |
Judging History
answer
#include <bits/stdc++.h>
/**
* author: samy nagy
*/
#define ll long long
#define all(vec) vec.begin(),vec.end()
#define Time cerr << "Time Taken: " << (float)clock() / CLOCKS_PER_SEC << " Secs" << "\n";
#define rall(vec) vec.rbegin(),vec.rend()
#define fx(x) fixed<<setprecision(x)
#define endl "\n"
using namespace std;
const int N = 2e6+10;
vector<ll>primes ;
void sieve (){
bool vis[N+1];
::memset(vis , true , sizeof vis);
vis[0]=vis[1]=false;
for (int i = 2; i*i<=N; ++i) {
if(vis[i]){
primes.push_back(i);
for (int j = i*i; j <=N; j+=i) {
vis[j]=false;
}
}
}
}
string s ;
bool ok (string tmp ){
return tmp.find(s)!=-1;
}
void smsm ( ){
sieve();
ll l , r ; cin>>l>>r>>s;
l--;
ll ans{};
for (int i = l; i <r && i<primes.size(); ++i) {
ans+=ok(to_string(primes[i]));
}
cout<<ans;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int t=1;//cin>>t;
while (t--){
smsm();
cout<<"\n";
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 4ms
memory: 5328kb
input:
1 10000 389
output:
1
result:
wrong answer 1st lines differ - expected: '45', found: '1'