luolie0804 @ 2023-05-18 19:00:15
#include<bits/stdc++.h>
using namespace std;
int hw(int n)
{
int s=0,g;
while(n>0)
{
g=n%10;s=s*10+g;n=n/10;
}
return s;
}
int isprime(int n)
{
if(n<2) return false;
for(int i=2;i<=sqrt(n);i++)
{
if(n%i==0)
{
return false;
}
}
return true;
}
int main()
{
int a,b;
cin>>a>>b;
for(int i=a;i<=b;i++)
{
if(hw(i)==i&&isprime(i))
{
cout<<i<<endl;
}
}
return 0;
}
by xiaoyang111 @ 2023-05-18 19:09:10
@luolie0804 你觉得这样不用策略就可以拿满分吗?看看数据(太大了)
by xiaoyang111 @ 2023-05-18 19:12:08
两个小黑子
by xiaoyang111 @ 2023-05-18 19:17:42
策略可以是只用判断奇数,这样时间复杂度降低了很多,当然还是拿不了满分最优解当然还是打表
by luolie0804 @ 2023-05-18 19:20:01
你看一下私信
by xiaoyang111 @ 2023-05-18 19:23:20
被关了,看我主页就知道了
by xiaoyang111 @ 2023-05-18 19:23:54
@luolie0804 都被关了,看一下我主页
by luolie0804 @ 2023-05-18 19:34:54
???????????????????????????????
by xiaoyang111 @ 2023-05-18 19:39:50
你先把那道题做了吧
by luolie0804 @ 2023-05-18 19:40:06
if(i==9989900)
break;
@xiaoyang111 这样可以吗???
by luolie0804 @ 2023-05-18 19:45:45
@xiaoyang111 你几年级???