牛客网暑期ACM多校训练营(第二场) 水博客. A.run 题意就是一个人一秒可以走1步或者跑K步,不能连续跑2秒,他从0开始移动,移动到[L,R]的某一点就可以结束.问一共有多少种移动的方式. 个人感觉是带约束条件的超级楼梯问题.说是dp其实就是递推吧.只要连续的两秒不是跑的就可以.所以在已经跑了i步的时候,直接考虑最后一步是跑的还是走的就可以了. 所以公式就是dp[i]=dp[i-1]+dp[i-1-k];然后前缀和预处理一下,直接从L的for到R的就可以了. 反正乱七八糟就出来了.现在写题…
牛客网暑期ACM多校训练营(第一场) A.Monotonic Matrix 这个题就是给你一个n*m的矩阵,往里面填{0,1,2}这三种数,要求是Ai,j⩽Ai+1,j,Ai,j⩽Ai,j+1 ,问你一共有几种填法. 变形一下就会发现其实是走非交叉格子路径计数,限制条件下的非降路径问题.就是从左上到右下走格子路径.从上到下为0——n,从左到右为0——m. 考虑 01 和 12 的分界线,是 (n, 0) 到 (0, m) 的两条不相交(可重合)路径,因为起点重合了,所以把其中一条路径往左上平移了…
2018牛客网暑期ACM多校训练营(第二场)I- car 链接:https://ac.nowcoder.com/acm/contest/140/I来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 White Cloud has a square of n*n from (1,1) to (n,n). White Rabbit wants to know the maximum…
链接:https://www.nowcoder.com/acm/contest/139/J来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 524288K,其他语言1048576K 64bit IO Format: %lld 题目描述 Given a sequence of integers a1, a2, ..., an and q pairs of integers (l1, r1), (l2, r2), ..., (lq, rq), find count(l1,…
链接:https://www.nowcoder.com/acm/contest/147/A来源:牛客网 Niuniu has recently learned how to use Gaussian elimination to solve systems of linear equations. Given n and a[i], where n is a power of 2, let's consider an n x n matrix A. The index of A[i][j] an…
链接:https://www.nowcoder.com/acm/contest/147/D来源:牛客网 Niuniu likes traveling. Now he will travel on a special graph. Given k and n, The directed graph contains n vertices, which are numbered from 0 to n - 1. For the vertex i, and for 1 <= j <= k, ther…
链接:https://www.nowcoder.com/acm/contest/140/B来源:牛客网 题目描述 White Rabbit wants to buy some drinks from White Cloud. There are n kinds of drinks, and the price of i-th drink is p[i] yuan per bottle. Since White Cloud is a good friend of White Rabbit, whe…
链接:https://www.nowcoder.com/acm/contest/139/D来源:牛客网 同构图:假设G=(V,E)和G1=(V1,E1)是两个图,如果存在一个双射m:V→V1,使得对所有的x,y∈V均有xy∈E等价于m(x)m(y)∈E1,则称G和G1是同构的,这样的一个映射m称之为一个同构,如果G=G1,则称他为一个自同构. 题目描述 Two undirected simple graphs and where are isomorphic when there exists…
链接:https://www.nowcoder.com/acm/contest/140/I来源:牛客网 White Cloud has a square of n*n from (1,1) to (n,n). White Rabbit wants to put in several cars. Each car will start moving at the same time and move from one side of one row or one line to the other…
链接:https://www.nowcoder.com/acm/contest/140/D来源:牛客网 White Cloud has built n stores numbered from 1 to n. White Rabbit wants to visit these stores in the order from 1 to n. The store numbered i has a price a[i] representing that White Rabbit can spend…