题意:有K个棋子在一个大小为N×N的棋盘.一开始,它们都在棋盘的顶端,它们起始的位置是 (1,a1),(1,a2),...,(1,ak) ,它们的目的地是 (n,b1),(n,b2),...,(n,bk). 一个位于 (r,c) 的棋子每一步只能向右走到 (r,c+1) 或者向下走到 (r+1,c) . 我们把 i 棋子从 (1,ai) 走到 (n,bi) 的路径记作 pi . 你的任务是计算有多少种方案把n个棋子送到目的地,并且对于任意两个不同的棋子 i,j ,使得路径 pi 与 pj 不相交…
题目链接 题意 : 给定方格中第一行的各个起点.再给定最后一行与起点相对应的终点.问你从这些起点出发到各自的终点.不相交的路径有多少条.移动方向只能向下或向右 分析 : 首先对于多起点和多终点的不相交路径.有一个LGV定理 实际上就是 n^2 构造矩阵.再计算其行列式 矩阵的构造方法可以看看这个 ==> Click here 那么接下来就是确定各自路径的方案数了 这是一个经典问题 这里需要求解组合数.用预处理阶乘逆元的方法即可求出 #include<bits/stdc++.h> #def…
有K个棋子在一个大小为N×N的棋盘.一开始,它们都在棋盘的顶端,它们起始的位置是 (1,a1),(1,a2),...,(1,ak) ,它们的目的地是 (n,b1),(n,b2),...,(n,bk). 一个位于 (r,c) 的棋子每一步只能向右走到 (r,c+1) 或者向下走到 (r+1,c) . 我们把 i 棋子从 (1,ai) 走到 (n,bi) 的路径记作 pi . 你的任务是计算有多少种方案把n个棋子送到目的地,并且对于任意两个不同的棋子 i,j ,使得路径 pi 与 pj 不相交(即没…
题意 给出\(n*n\)网格\((n<=10^5)\) 顶部有\(K\)个起点,底部有\(K\)个相对应的终点 每次只能向下或向右走 求有多少种从各个起点出发到达对应终点且路径不相交的路径? 对\(10^9 + 7\)取模 题解 按照组合数的套路 二维空间从一个h * w的矩形左上角走到右下角只向下或向右走的方案数为\(C_{h + w}^{h}\) 这题直接求不好求,我们考虑容斥 可以发现,如果两个路径相交,就相当于交换了终点 那么我们枚举每个起点的终点,乘上一个容斥系数\((-1)^t\),…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5120 A ring is a 2-D figure bounded by two circles sharing the common center. The radius for these circles are denoted by r and R (r < R). For more details, refer to the gray part in the illustration bel…
Intersection Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5120 Description Matt is a big fan of logo design. Recently he falls in love with logo made up by rings. The following figures are some famous examples…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5120 解题报告:给你两个完全相同的圆环,要你求这两个圆环相交的部分面积是多少? 题意看了好久没懂.圆环由一个大圆里面套一个小圆,中间部分就是圆环,两圆环相交面积 = 大圆相交的面积 - 2*大圆与小圆相交的面积 + 小圆与小圆相交的面积. 也就是说,这题就可以化为求两个圆的相交的面积了.可以利用两个圆的方程,求出圆的交点所在的直线,然后求出圆心到这条直线的距离,就可以求出两个圆对应的扇形的圆心角是多…
Matt is a big fan of logo design. Recently he falls in love with logo made up by rings. The following figures are some famous examples you may know.A ring is a 2-D figure bounded by two circles sharing the common center. The radius for these circles…
Intersection Time Limit: 4000/4000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others) Problem Description Matt is a big fan of logo design. Recently he falls in love with logo made up by rings. The following figures are some famous examp…
There are K pieces on the chessboard. The size of the chessboard is N*N. The pieces are initially placed on the top cells of the board. A piece located on (r, c) can be moved by one cell right to (r, c + 1) or one cell down to (r+1, c). Your task is…