2 条题解

  • 0
    @ 2025-9-8 15:21:16
    #include<bits/stdc++.h>
    using namespace std;
    int main() {
    	int a,b;
    	vector<int> data={2,3,5,7,11,101,131,151,181,191,313,353,373,383,727,757,787,797,919,929,10301,10501,10601,11311,11411,12421,12721,12821,13331,13831,13931,14341,14741,15451,15551,16061,16361,16561,16661,17471,17971,18181,18481,19391,19891,19991,30103,30203,30403,30703,30803,31013,31513,32323,32423,33533,34543,34843,35053,35153,35353,35753,36263,36563,37273,37573,38083,38183,38783,39293,70207,70507,70607,71317,71917,72227,72727,73037,73237,73637,74047,74747,75557,76367,76667,77377,77477,77977,78487,78787,78887,79397,79697,79997,90709,91019,93139,93239,93739,94049,94349,94649,94849,94949,95959,96269,96469,96769,97379,97579,97879,98389,98689};
        cin>>a>>b;
        for(auto it=lower_bound(data.begin(),data.end(),a);it!=upper_bound(data.begin(), data.end(),b);++it) 
    		cout<<*it<<endl;
    	return 0;
    }
    
    • 0
      @ 2025-9-6 17:33:58
      #include<bits/stdc++.h>
      using namespace std;
      bool zhishu(int n) 
      {
      	if (n<=1) 
      		return false;
      	for (int i=2;i<n;i++) 
      	{
      		if (n% i==0) 
      			return false;
      	}
      	return true;
      }//质数检测
      bool huiwen(int n)
      {
      	int a,b;
      	a=0;
      	b=n;
      	while(b>0)
      	{
      		a=a*10+b%10;
      		b=b/10;
      	}
      	if(a==n)
      		return true;
      	else
      		return false;
      }//回文数检测
      int main()
      {
      	int a,b,i,f,g,c;
      	cin>>a>>b;
      	for(i=a;i<=b;i++)
      	{
      		c=zhishu(i);
      		if(c==1)//true
      		{
      			c=huiwen(i);
      			if(c==1)
      				cout<<i<<endl;
      		}
      	} 
      	return 0;
      }
      
      • 1

      信息

      ID
      187
      时间
      1000ms
      内存
      256MiB
      难度
      8
      标签
      递交数
      101
      已通过
      16
      上传者