matrix Problem Description Given a matrix with n rows and m columns ( n+m is an odd number ), at first , you begin with the number at top-left corner (1,1) and you want to go to the number at bottom-right corner (n,m). And you must go right or go dow…
题意: 给你一个矩阵,要求从左上角走到右下角,走个的费用:a[1]*a[2] + a[3]*a[4] + ......+ a[2n-1]*a[2n] 思路: 果然不机智,自己把自己套路了 对于每个奇数点,如下图的有下角的点它便可由3个值为2的点到达,具体画图便知. 所以我们可以用类似dp的方法,找出每个点的奇数点最优解,注意下边界即可 1 1 1 2 1 1 2 1 1 2 1 1 #include <iostream> #include <cstdlib> #include &l…
sequence2 Problem Description Given an integer array bi with a length of n, please tell me how many exactly different increasing subsequences. P.S. A subsequence bai(1≤i≤k) is an increasing subsequence of sequence bi(1≤i≤n) if and only if 1≤a1<a2<..…
感觉有些无聊的比赛. A 暴力枚举下就行 B 简单的dp,但是wa了一发后就去先把C做了,然后发现如果输入的100个数,是如1,2,3,4,...,100,然后k=50,个数为c(100,50).果断大数.用了个c++的大数模板,感觉用的很爽. #include <iostream> #include <stdio.h> #include <string.h> using namespace std; #define DIGIT 4 //四位隔开,即万进制 #defin…
B题...水题,记录当前行是由原矩阵哪行变来的. #include<cstdio> #include<cstring> #include<cstdlib> #include<iostream> #include<queue> #include<stack> #include<cmath> #include<algorithm> #include<malloc.h> using namespace s…
sequence1  Given an array a with length n, could you tell me how many pairs (i,j) ( i < j ) for abs(ai−aj) mod b=c.   Input Several test cases(about 5) For each cases, first come 3 integers, n,b,c(1≤n≤100,0≤c<b≤109) Then follows n integers ai(0≤ai≤1…
Baby Ming and Weight lifting Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 681    Accepted Submission(s): 280 Problem Description Baby Ming is fond of weight lifting. He has a barbell pole(the…
tree Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 863    Accepted Submission(s): 409 Problem Description There is a tree(the tree is a connected graph which contains n points and n−1 edges),t…
HDOJ5054 Alice and Bob Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 302    Accepted Submission(s): 229 Problem Description Bob and Alice got separated in the Square, they agreed that if they…
LCP Array  Accepts: 131  Submissions: 1352  Time Limit: 4000/2000 MS (Java/Others)  Memory Limit: 131072/131072 K (Java/Others) 问题描述 Peter有一个字符串s=s_{1}s_{2}...s_{n}s=s​1​​s​2​​...s​n​​, 令\text{suff}_i =s_{i}s_{i+1}...s_{n}suff​i​​=s​i​​s​i+1​​...s​n​…