要先判断是否为质数,再判断回文数,不然会TLE

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

xizao_haoxuan @ 2024-08-18 21:08:09

for(int i=a;i<=b;i++) { if(isprime[i]) { if(h(i)==1) { cout<<i<<endl; } } }


by are_you_sure @ 2024-08-18 21:19:08

@xizao_haoxuan 所以这是讨论区题解吗


by guangtougun @ 2024-08-19 08:52:11

@xizao_haoxuan 问一下isprime是数组名吗?


by xizao_haoxuan @ 2024-08-19 11:05:25

@are_you_sure 这只是一小部分,不是AC代码?


by xizao_haoxuan @ 2024-08-19 11:06:21

@guangtougun isprime是数组名


by are_you_sure @ 2024-08-19 11:10:07

@xizao_haoxuan 没举报,不用辩解了


|