最后一个没有过呜呜呜

P1217 [USACO1.5] 回文质数 Prime Palindromes

henry123456789 @ 2023-04-16 09:54:42

#include <bits/stdc++.h>
using namespace std;
bool is_prime[1000000000];
int n,m;int cont;
int main(){
    std::ios::sync_with_stdio(0);
    cin>>n>>m;
    for(int i=2;i<=m;i++){
        is_prime[i]=true;
    }
    for(int i=2;i<=m;i++){
        string s;
        string s1;
        if(is_prime[i]){
            for(int k=2;k*i<=m;k++){
                is_prime[k*i]=false;
            }
            if(i>=n){
                s=to_string(i);
                s1=s;
                reverse(s1.begin(),s1.end());
                if(s1==s){
                    if(i>=n)cout<<i<<"\n";
                }
            }
        }
    }
}

by henry123456789 @ 2023-04-16 09:55:07

怎么办啊


by joker_martin @ 2023-04-16 10:47:44

枅楍鋈 (认出来的送ctsc任意三题全解)


|