/ /

记录详情

Time Exceeded

foo.cc: In function 'int sushu(int)':
foo.cc:18:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
正在同步测试数据,请稍后
[Hydro](https://hydro.ac)提供评测服务
# 状态 耗时 内存占用
#1 Wrong Answer Read 5, expect 4. 1ms 384.0 KiB
#2 Wrong Answer Read 50, expect 1. 2ms 352.0 KiB
#3 Wrong Answer Read 50, expect 15. 2ms 384.0 KiB
#4 Wrong Answer Read 500, expect 0. 8ms 396.0 KiB
#5 Wrong Answer Read 500, expect 93. 74ms 388.0 KiB
#6 Wrong Answer Read 5000, expect 0. 735ms 432.0 KiB
#7 Time Exceeded ≥1437ms ≥384.0 KiB
#8 Time Exceeded ≥1147ms ≥408.0 KiB

代码

#include<iostream>
#include<cmath>
int sushu(int i)
{
	int flog=0,m;
	for(m=2;m<=sqrt(i);m++)
	{
		if(i%m==0)
		{
			flog=1;
			break;
		}
		if(flog==0&&i!=1)
		return 1;
		else
		return 0;
	}
}
int huiwen(int i)
{
	int sum=0,a=i;
	while(i)
	{
		sum=sum*10+i%10;
		i/=10;
	}
	if(a==sum)
	return 1;
	else
	return 0;
}
using namespace std;

int main()
{
int m,i,sum=0;
cin>>m;
for(i=pow(10,m);i<=pow(10,m+1)-1;i++)
{
if(sushu(i)&&huiwen(i))	
sum++;
}
cout<<sum;
}

信息

递交者
类型
递交
题目
P1028 回文素数
题目数据
下载
语言
C++
递交时间
2021-08-12 14:29:08
评测时间
2021-08-12 14:29:08
评测机
分数
0
总耗时
≥3411ms
峰值内存
≥432.0 KiB