@[zxc57838706](/space/show?uid=196686) a可以开bool吧
by Celestial_Scarlet @ 2019-04-02 19:40:48
@[baoyu](/space/show?uid=93465) 哦,对,刚自学c++有点不太灵活,我试试能不能过
by zxc57838706 @ 2019-04-02 19:53:05
@[zxc57838706](/space/show?uid=196686) 开bool应该也不行qwq
bitset<N> a;
这样开bool数组空间是原来的 $\dfrac18$ ,应该可以吧
by Celestial_Scarlet @ 2019-04-02 19:55:48
@[baoyu](/space/show?uid=93465) 改完之后居然TLE了
by zxc57838706 @ 2019-04-02 19:56:37
int改Bool之后没有MLE了,但是TLE,cin cout改成scanf printf也没用,崩了
by zxc57838706 @ 2019-04-02 20:16:10
//蒟蒻求救,为何没有输出
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int a,b,n[101];
int hw(int x)
{
int t=1;
while(x!=0)
{
n[t]=x%10;
x/=10;
t++;
}
for(int i=1;i<=t;i++)
if(n[i]!=n[t-i+1]) return 0;
return 1;
}
int ss(int x)
{
for(int i=2;i<=sqrt(x);i++)
if(x%i==0) return 0;
return 1;
}
int main()
{
cin>>a>>b;
for(int i=a;i<=b;i++)
{
if(ss(i)&&hw(i)) cout<<i<<endl;
}
return 0;
}
by 月影、烛龙 @ 2019-04-13 22:05:34
希望更丰富的展现?使用Markdown
by Andy_Lin @ 2020-01-17 17:43:27