Subsequence
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 3995    Accepted Submission(s): 1308
Problem Description
There is a sequenc...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 06:47:40   
                                阅读次数:
275
                             
                    
                        
                            
                            
                                错了29遍,终成正果。。。。。
根据题意,很容易的可以想到容斥。
然后的问题就是如何求
sum(n)=1^4+2^4+3^4+....+n^4;
有三种道路:
很显然:1^4+2^4+3^4+....+n^4=(n^5)/5+(n^4)/2+(n^3)/3-n/30;
则1,用java的大数去敲这个的代码。
2,用c++敲,但是用到分数取模,求逆元。
3,用c++敲,但是不用这...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 06:36:06   
                                阅读次数:
328
                             
                    
                        
                            
                            
                                题意:输出一个元素在一个已排序的数组中的位置,如果不存在输出它应该插入的位置
思路:二分查找,如果找到就输出位置,找不到就输出它应该插入的位置
复杂度:时间O(log n),空间O(1)    
相关题目:
Search for a Range
Search a 2D Matrix...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 05:57:32   
                                阅读次数:
271
                             
                    
                        
                            
                            
                                /*
* hdu How many prime numbers
* date 2014/5/13
* state AC
*/
#include 
#include 
#include 
using namespace std;
bool isPrime(int x)
{
    int sqr=sqrt(x*1.0);
    for(int i=2;i<=sqr;i++)
    {...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 05:07:18   
                                阅读次数:
261
                             
                    
                        
                            
                            
                                Problem Description
The new semester begins! Different kinds of student societies are all trying to advertise themselves, by giving flyers to the students for introducing the society. However, due ...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 03:57:24   
                                阅读次数:
311
                             
                    
                        
                            
                            
                                http://acm.hdu.edu.cn/showproblem.php?pid=4635
Strongly connected
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1381    Accepted Sub...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 03:26:53   
                                阅读次数:
248
                             
                    
                        
                            
                            
                                题意:给一个整数序列(可能有负数),求最短的连续序列使得序列之和大于等于整数x;
解法:第一种是On的复杂度:
                  我们要的是sum[j]-sum[i]>=x,如果有两个决策j = sum[j'],那么j就是没用的。即维护一个sum[j]递增序列。然后每次可以二分查找,但是这里有个特点就是要得到最近的,可以同时维护一个left指针,left指针用于跟进更...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 03:20:26   
                                阅读次数:
303
                             
                    
                        
                            
                            
                                #include 
#include 
#include 
#include 
#include 
#include 
using namespace std;
struct ssss
{
    ssss *c[26];
    int n,v;
}*s;
void insert(char *str,int v)
{
    int i,j,k,l;
    ssss *p,*q;
    p=...
                            
                            
                                分类:
其他好文   时间:
2014-05-14 15:06:54   
                                阅读次数:
357
                             
                    
                        
                            
                            
                                /*
* hdu 最小公倍数
* date 2014/5/13
* state AC
*/
#include 
using namespace std;
int gcd(int x,int y)
{
    while(x!=y)
    {
        if(x>y)x=x-y;
        else y=y-x;
    }
    return x;
}
int main()
...
                            
                            
                                分类:
其他好文   时间:
2014-05-14 14:29:59   
                                阅读次数:
225