链接:https://www.nowcoder.com/acm/contest/147/A 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 Niuniu has recently learned how to use Gaussian elimination to solve systems of linear equations. Given n and a[i], wh…
题目链接:https://ac.nowcoder.com/acm/contest/889/H 题意:给出n颗竹子的高度,q次询问,每次询问给出l,r,x,y,每次选取[l,r]中的竹子,砍y次砍掉所有竹子,每次砍下来的竹子长度和是相同的,问你第x次应该砍在哪个高度上 解题思路:由于总共砍的次数已经给出,因此我们可以知道砍x次总共砍的量 Total = $\sum\limits_{i=l}^{r}$h[i]*x/y,那么问题就变成了一个方程$\sum\limits_{i=l}^{r}$max(0,…
链接: https://www.nowcoder.com/acm/contest/139/B 题意: 求满足以下条件的n*n矩阵A的数量模m:A(i,j) ∈ {0,1,2}, 1≤i,j≤n.A(i,j) = A(j,i), 1≤i,j≤n.A(i,1) + A(i,2) + ... + A(i,n) = 2, 1≤i≤n.A(1,1) = A(2,2) = ... = A(n,n) = 0.其中1≤n≤1e5, 1≤m≤1e9. 分析: 把矩阵看成无向图的邻接矩阵,即要求所有点度为2,即每个…
链接: https://www.nowcoder.com/acm/contest/139/A 题意: 求满足以下条件的n*m矩阵A的数量模(1e9+7):A(i,j) ∈ {0,1,2}, 1≤i≤n, 1≤j≤m.A(i,j) ≤ A(i+1,j), 1≤i<n, 1≤j≤m.A(i,j) ≤ A(i,j+1), 1≤i≤n, 1≤j<m.其中1 ≤ n,m ≤ 1e3. 分析: 考虑01和12的分界线,是(n,0)到(0,m)的两条不相交(可重合)路径.平移其中一条变成(n+1,1)到(1…
链接:https://www.nowcoder.com/acm/contest/147/E 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 Niuniu likes to play OSU! We simplify the game OSU to the following problem. Given n and m, there are n clicks. Each c…
链接:https://www.nowcoder.com/acm/contest/145/J 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K Special Judge, 64bit IO Format: %lld 题目描述 You have a n * m grid of characters, where each character is an English letter (lowercase or uppercase, w…
链接:https://www.nowcoder.com/acm/contest/145/C 来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 262144K,其他语言524288K Special Judge, 64bit IO Format: %lld 题目描述 A binary string s of length N = 2n is given. You will perform the following operation n times : - Choos…
链接:https://www.nowcoder.com/acm/contest/145/A 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K Special Judge, 64bit IO Format: %lld 题目描述 You have a complete bipartite graph where each part contains exactly n nodes, numbered from 0 to n - 1…
链接:https://www.nowcoder.com/acm/contest/141/C 来源:牛客网 题目描述 Eddy likes to play cards game since there are always lots of randomness in the game. For most of the cards game, the very first step in the game is shuffling the cards. And, mostly the randomn…
链接:https://www.nowcoder.com/acm/contest/141/E 来源:牛客网 题目描述 Eddy likes to play with string which is a sequence of characters. One day, Eddy has played with a string S for a long time and wonders how could make it more enjoyable. Eddy comes up with foll…