线性推,矩阵乘法+快速幂求通项。
传送门:点击打开链接
#include 
#include 
#include 
#include 
using namespace std;
#define LL long long
struct Mat{
    LL f[2][2];
};
LL MOD;
Mat mul(Mat a,Mat b)
{
    LL i,j,k;
   ...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 14:53:10   
                                阅读次数:
225
                             
                    
                        
                            
                            
                                插头DP,多条回路求回路数。
可以当作模版来记。注重理解轮廓线。
#include 
#include 
#include 
#include 
using namespace std;
const int HASH=10007;
const int STATE=5000; //状态数
const int MAXD=15;
int code[MAXD],maze[MAXD][MAXD];...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 11:23:33   
                                阅读次数:
344
                             
                    
                        
                            
                            
                                详细的证明:点击打开链接
我的想法:
要想保证题目所说 构造最小行的和,只能是这种情况
.....      m-3  m-2  m-1  m    |   m  m-1  m-2  m-3    . .... 
所以Ans 也就是取前N项就可。
又因为 It is guaranteed that N is always odd。  显然构造没问题。
#include 
#in...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 06:28:56   
                                阅读次数:
200
                             
                    
                        
                            
                            
                                /*
* hdu AC Me
* date 2014/5/13
* state AC
*/
#include 
#include 
#include 
#include 
using namespace std;
const int MAXN=100001;
char Arr[MAXN];
int cnt[26];
int main()
{
    //cout << "Hello wor...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 06:16:24   
                                阅读次数:
247
                             
                    
                        
                            
                            
                                Robot Motion
Problem Description
A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 05:48:40   
                                阅读次数:
346
                             
                    
                        
                            
                            
                                插头DP。
题目要求构造出K条回路的方案数,而且不能出现环套环。
Sol:通过增加标记为来记录形成的回路数,假如不形成环的话就是在形成新的环路,此时,两边的插头个数要为偶数。
#include
#include
#include
#include
using namespace std;
const int MAXD=15;
const int STATE=1000010;
const i...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 03:53:23   
                                阅读次数:
272
                             
                    
                        
                            
                            
                                插头DP。
从左上角到右下角,每个格子都有Val,每个格子只能经过一次,可以不经过,求最大的分数之和。
#include
#include
#include
#include
using namespace std;
const int MAXD=15;
const int HASH=10007;
const int STATE=1000010;
int N,M;
int maz...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 03:43:02   
                                阅读次数:
175
                             
                    
                        
                            
                            
                                HDU 1561 The more ,The Better...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 02:57:01   
                                阅读次数:
182
                             
                    
                        
                            
                            
                                /*
* hdu OpenDoorManAndCloseDoorMan
* date 2014/5/13
* state AC
*/
#include 
#include 
#include 
#include 
using namespace std;
struct DoorMan
{
    char name[20];
    int startH,startM,startS;
    ...
                            
                            
                                分类:
其他好文   时间:
2014-05-14 14:58:40   
                                阅读次数:
247
                             
                    
                        
                            
                            
                                /*
* 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