首先是DP,分段DP(按位数讨论) 然后每一段构造出它对应的矩阵,用矩阵快速幂加速 type matrix=..,..]of int64; var n,m:int64; a,b,c,d:matrix; function min(x,y:int64):int64; begin if x<y then exit(x); exit(y); end; procedure cheng(var a,b:matrix); var i,j,k:longint; begin do do d[i,j]:=; do…
Keep In Touch Problem Description There are n cities numbered with successive integers from 1 to n in Byteland. Also, there are m one-way roads connecting the cities. The starting point of the i-th road is ui while the ending point is vi. There are…
Maximum sum Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 38079 Accepted: 11904 Description Given a set of n integers: A={a1, a2,..., an}, we define a function d(A) as below: Your task is to calculate d(A). Input The input consists o…
http://acm.hdu.edu.cn/showproblem.php?pid=1024 Max Sum Plus Plus Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 45548 Accepted Submission(s): 16529 Problem Description Now I think you have g…
Scout YYF I Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10214 Accepted: 2980 Description YYF is a couragous scout. Now he is on a dangerous mission which is to penetrate into the enemy's base. After overcoming a series difficulties…
D. Slalom time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Little girl Masha likes winter sports, today she's planning to take part in slalom skiing. The track is represented as a grid comp…
题目链接: D. Kindergarten time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output In a kindergarten, the children are being divided into groups. The teacher put the children in a line and associated e…