CF559C Gerald and Giant Chess】的更多相关文章

题意 C. Gerald and Giant Chess time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the…
题意 $h \times w$的网格,有$n$个障碍点, 每次可以向右或向下移动 求从$(1, 1)$到$(h, w)$不经过障碍点的方案数 Sol 容斥原理 从$(1, 1)$到$(h, w)$不经过障碍点的方案数为$C(h + w, h)$ 设$f[i]$表示到达第$i$个黑格子的合法路径的方案数 首先对所有点按$x$排序,这样就能保证每次从他的左上方转移而来 然后根据公式算一下就好了 // luogu-judger-enable-o2 #include<iostream> #includ…
给定一个 \(H*W\)的棋盘,棋盘上只有\(N\) 个格子是黑色的,其他格子都是白色的. 在棋盘左上角有一个卒,每一步可以向右或者向下移动一格,并且不能移动到黑色格子中.求这个卒从左上角移动到右下角,一共有多少种可能的路线 \(1\le H,W\le 10^5,1\le N\le 2000\) 输出对\(10^9+7\)取模 H,W巨大,普通DP不用想,考虑如何用黑格子计数 由组合数学知识可知,从S到T的总路径条数为\(C_{H+W-2}^{H-1}\),只要减去至少经过一个黑格子的路径条数即…
[题解]CF559C C. Gerald and Giant Chess(容斥+格路问题) 55336399 Practice: Winlere 559C - 22 GNU C++11 Accepted 186 ms 1608 KB 2019-06-09 17:03:21 2019-06-09 17:03:21 一道小水题(为什么2400??我为什么之前被一道2200锤QAQ) 有个很显然的公式,在组合数学那本书上面也有. 从坐标\((0,0)\)到坐标\((x,y)\)总共有\({x+y}\c…
Gerald and Giant Chess Problem's Link: http://codeforces.com/contest/559/problem/C Mean: 一个n*m的网格,让你从左上角走到右下角,有一些点不能经过,问你有多少种方法. analyse: BZOJ上的原题. 首先把坏点和终点以x坐标为第一键值,y坐标为第二键值排序 . 令fi表示从原点不经过任何坏点走到第i个点的个数,那么有DP方程: fi=Cxixi+yi−∑(xj<=xi,yj<=yi)C(xi−xj)…
C. Gerald and Giant Chess time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the ga…
Gerald and Giant Chess time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game…
E. Gerald and Giant Chess time limit per test 2 seconds memory limit per test 256 megabytes2015-09-09 input standard input output standard output Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say t…
C. Gerald and Giant Chess Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559/problem/C Description Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to . The…
C. Gerald and Giant Chess time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the ga…