首先想到的是,将这个数进行素因子分解,得到所有的因子,然后取最大的。 
首先写一个判断一个数是否是素数的方法: #judge a number whether a prime def 
judgePrime(self,number,pme): if number < 2: ...
                            
                            
                                分类:
编程语言   时间:
2014-05-01 09:05:26   
                                阅读次数:
3333
                             
                    
                        
                            
                            
                                Problem XHuge ModInput:standard 
inputOutput:standard outputTime Limit:1 secondThe operator for exponentiation is 
different from the addition, subtract...
                            
                            
                                分类:
其他好文   时间:
2014-05-01 09:03:35   
                                阅读次数:
540
                             
                    
                        
                            
                            
                                IIUPC2006Problem G: Going in Cycle!!Input: 
standard inputOutput: standard outputYou are given a weighted directed graph 
withnvertices andmedges. Each ...
                            
                            
                                分类:
其他好文   时间:
2014-05-01 04:32:53   
                                阅读次数:
271
                             
                    
                        
                            
                            
                                这个方法太厉害了 
别人的记录一下#include#include#include#include#include#include#includeusing namespace 
std;#define MAX_PRIME 31700#define PRIME_NUM 3500int Primes[ P...
                            
                            
                                分类:
其他好文   时间:
2014-05-01 03:48:49   
                                阅读次数:
276
                             
                    
                        
                            
                            
                                题目链接:11538 - Chess Queen
题意:给一个n*m棋盘,问放两个皇后,使得两个皇后互相能攻击到,有几种放法
思路:分横竖,对角线来考虑。
横:n * A(m, 2)种
竖:m * A(n, 2)种
对角线:由于有两条,可以算一条再乘2
2 * 所有对角线和(A(对角线格数,2))。
那么对角线格数为:(1, 2, 3, 4 ... n .n .n .n.n - 1....
                            
                            
                                分类:
其他好文   时间:
2014-04-29 13:38:20   
                                阅读次数:
387
                             
                    
                        
                            
                            
                                题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=251
测模版:
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;
#define ...
                            
                            
                                分类:
其他好文   时间:
2014-04-29 13:31:21   
                                阅读次数:
542
                             
                    
                        
                            
                            
                                算法入门经典关于区间覆盖的讲解:
8.4.6:区间覆盖问题...
                            
                            
                                分类:
其他好文   时间:
2014-04-29 13:21:23   
                                阅读次数:
262
                             
                    
                        
                            
                            
                                uva 10084 Hotter Colder
题目大意:
有一个人玩游戏,起初是个左下角(0,0) 右上角(10,10)的矩形,有一个宝藏藏在这之间。这个人起初在(0,0) 每次走到一个点,会告诉你与原来的点相比距离宝藏近了还是远了,还是不变,根据这个每次求宝藏的范围(面积)。
解题思路:
每次相当于形成一个新的范围是凸包,只需要求这个凸包所有的点,然后按照极角排序,求面积。
这题wa了很多次,感觉代码略麻烦了一点点。
代码:见文章...
                            
                            
                                分类:
其他好文   时间:
2014-04-28 10:14:41   
                                阅读次数:
370
                             
                    
                        
                            
                            
                                RSA is one of the most powerful methods to encrypt data. The RSA algorithm is described as follow:
> choose two large prime integer p, q
> calculate n = p × q, calculate F(n) = (p - 1) × (q - 1)
...
                            
                            
                                分类:
其他好文   时间:
2014-04-27 21:37:59   
                                阅读次数:
315