有人问我这个问题。
个人感觉暴搜会TLE O(n*sqrt(n))。n=100000000;(判断素数用2~sqrt(n)+1 去除)
还是枚举好了。枚举 1~10000,把他每一位存下来,回文数已知 left ,求 right ,然后组合起来。
例如 1 ,判断 11 是否素数。
例如 10 ,判断 101 是否素数, 判断 1001 是否素数。
这样复杂度就是 O(n^2)。 开始我 bool pa[100000000] 准备用标记来确定。结果MLE。
然后算了一下 总共有多少个数,最多 781 个。 ...
                            
                            
                                分类:
其他好文   时间:
2014-11-06 22:03:02   
                                阅读次数:
172
                             
                    
                        
                            
                            
                                H -
Happy 2006
Time Limit:3000MS    Memory Limit:65536KB    64bit IO Format:%I64d
 & %I64u
Submit  
 Status
Description
Two positive integers are said to be relatively prime to each o...
                            
                            
                                分类:
移动开发   时间:
2014-11-06 09:26:50   
                                阅读次数:
157
                             
                    
                        
                            
                            
                                Prime Test
Time Limit: 6000MS
 
Memory Limit: 65536K
Total Submissions: 24514
 
Accepted: 5730
Case Time Limit: 4000MS
Description
Given a big integer number, you are ...
                            
                            
                                分类:
其他好文   时间:
2014-11-05 23:13:24   
                                阅读次数:
237
                             
                    
                        
                            
                            
                                Power of CryptographyBackgroundCurrent work in cryptography involves (among other things) large prime numbers and computing powers of numbers modulo f...
                            
                            
                                分类:
其他好文   时间:
2014-11-05 21:03:37   
                                阅读次数:
237
                             
                    
                        
                            
                            
                                Description
The branch of mathematics called number theory is about properties of numbers. One of the areas that has captured the interest of number theoreticians for thousands of years is the qu...
                            
                            
                                分类:
其他好文   时间:
2014-11-05 00:33:10   
                                阅读次数:
200
                             
                    
                        
                            
                            
                                C++ Primer第五版这本书是久负盛名的C++经典教程,本篇博文为C++Primer(第五版)中文版第八章课后编程习题解答。...
                            
                            
                                分类:
编程语言   时间:
2014-11-04 19:45:55   
                                阅读次数:
301
                             
                    
                        
                            
                            
                                POJ 2478 Farey Sequence ( 欧拉函数 + 法雷数列 )#include #include using namespace std;#define MAXN 1000005typedef long long LL;int vis[ MAXN ], prime[ MAXN ],....
                            
                            
                                分类:
其他好文   时间:
2014-11-04 16:44:16   
                                阅读次数:
197
                             
                    
                        
                            
                            
                                A:Aizu 0009 Prime
 Number:素数筛选,注意可能爆内存!!。
#include
#include
#include
#include
#include
typedef long long LL;
using namespace std;
#define REPF( i , a , b ) for ( int i = a ; i <= b ; ++ i )
#defin...
                            
                            
                                分类:
其他好文   时间:
2014-11-04 15:07:04   
                                阅读次数:
254
                             
                    
                        
                            
                            
                                本题是06年百度之星半决赛的题目,图论的最小割问题,算是图论高级内容吧。
Stoer Wager算法,其中的难点是:
1 逐条边查找最大的边的权值-过程有点想Prime算法,不过实际上不是Prime算法,因为目的并不是最大生成树,而是需要把一个顶点的所有边都加起来,把这些边去掉,就是这个顶点的割点值了。那么就需要遍历整个图,到了最后一个节点才能保证是找到了这个节点的所有边。
2 缩点:所谓缩点就是把最后一个节点去掉,同时保留其边值信息,实际就是保留这个顶点的和其他顶点相连的最小边值。
比较难理解的,一般写这...
                            
                            
                                分类:
其他好文   时间:
2014-11-04 08:06:33   
                                阅读次数:
273
                             
                    
                        
                            
                            
                                Prime Ring ProblemTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 25187Accepted Submission(s): 112...
                            
                            
                                分类:
其他好文   时间:
2014-11-03 19:16:23   
                                阅读次数:
156