QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#98789#2919. SubprimesamynagyWA 4ms5328kbC++141.2kb2023-04-20 06:00:232023-04-20 06:00:27

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-20 06:00:27]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:5328kb
  • [2023-04-20 06:00:23]
  • 提交

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'