dp - Codeforces Round #313 (Div. 1) C. Gerald and Giant Chess
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)(xi−xj)+(yi−yj)∗fj
当于枚举第一个遇到的坏点是啥,然后从总方案里减掉。
然后再利用组合数取模就行。
(http://blog.csdn.net/popoqqq/article/details/46121519)
Time complexity: O(N*N)
Source code:
;
);
; ; ;
;
);
; );
; ; ) ; ; ;
}
dp - Codeforces Round #313 (Div. 1) C. Gerald and Giant Chess的更多相关文章
- Codeforces Round #313 (Div. 1) C. Gerald and Giant Chess DP
C. Gerald and Giant Chess Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest ...
- Codeforces Round #313 (Div. 2) E. Gerald and Giant Chess (Lucas + dp)
题目链接:http://codeforces.com/contest/560/problem/E 给你一个n*m的网格,有k个坏点,问你从(1,1)到(n,m)不经过坏点有多少条路径. 先把这些坏点排 ...
- Codeforces Round #313 (Div. 1) C. Gerald and Giant Chess
这场CF又掉分了... 这题题意大概就给一个h*w的棋盘,中间有一些黑格子不能走,问只能向右或者向下走的情况下,从左上到右下有多少种方案. 开个sum数组,sum[i]表示走到第i个黑点但是不经过其他 ...
- Codeforces Round #313 (Div. 1) A. Gerald's Hexagon
Gerald's Hexagon Problem's Link: http://codeforces.com/contest/559/problem/A Mean: 按顺时针顺序给出一个六边形的各边长 ...
- Codeforces Round #313 (Div. 2) C. Gerald's Hexagon 数学
C. Gerald's Hexagon Time Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559/pr ...
- Codeforces Round #313 (Div. 1) A. Gerald's Hexagon 数学题
A. Gerald's Hexagon Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559/p ...
- Codeforces Round #313 (Div. 2) B. Gerald is into Art 水题
B. Gerald is into Art Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/560 ...
- 【打CF,学算法——三星级】Codeforces Round #313 (Div. 2) C. Gerald's Hexagon
[CF简单介绍] 提交链接:http://codeforces.com/contest/560/problem/C 题面: C. Gerald's Hexagon time limit per tes ...
- Codeforces Round #313 (Div. 2) C. Gerald's Hexagon(补大三角形)
C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
随机推荐
- Windows下msysGit使用及相关配置
Windows下msysGit使用 目前我们git通过ssh进行通信,所以需要你也安装ssh以及将ssh key发给我,省得每次都需要输入用户名和密码 1.创建工程目录 windows下进入msysG ...
- 文件系统管理 之 Linux 查看磁盘分区、文件系统、使用情况的命令和相关工具介绍
一.df 命令:df 是来自于coreutils 软件包,系统安装时,就自带的:我们通过这个命令可以查看磁盘的使用情况以及文件系统被挂载的位置: 举例: [root@localhost beinan] ...
- ffrpc的php客户端lib
摘要: ffrpc 是c++异步通讯库,使用ffrpc可以非常容易的构建服务器程序.为了使用方便,ffrpc提供了python.php的客户端lib,这样使用php于c++构建的server也是顺手拈 ...
- jeos没有消亡,但看 debian 的 netinst .iso格式,那就是jeos的系统!
曾经ubuntu推出专供轻量硬件(如虚拟机)方式的just os格式的.iso [小巧.轻量.快速.干净] 但在 ubuntu 8.04后 再也没有继续 ...... 可惜 不曾想,ubuntu的老爸 ...
- 画蛇添足-记spring3 hibernate4整合时遇到问题的处理办法
最近在来到一个新公司,使用新的spring3,hibernate4框架,在使用注解事务总是不起作用. 首先看配置文件,然后再讲解. 首先是springmvc-servlet.xml,这个配置文件是se ...
- [转]一个小试验验证对象的指针计数置为nil的情况
本文转载于新风作浪的博客专栏,博客地址:http://blog.csdn.net/duxinfeng2010/article/details/8757211 以下博客原文: 最近遇到这样一个问题,以前 ...
- 再也不必当心我的密码了,多个SAP 客户端自动输入密码
再也不必当心我的密码了,多个SAP 客户端自动输入密码问题: 通常对于OFFICE人员来说,一天有很多的密码,OA密码,多个ERP密码,邮箱密码,代理密码等等,还经常60天过期之类,实在是焦头烂额. ...
- 64bit ubuntu 安装32bit的软件
在64bit的系统上安装32bit的软件时,会提示: file not found or no such file. 此时只需要安装 sudo apt-get install libc6-dev-i3 ...
- FAILURE: Build failed with an exception.
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:installD ...
- 状态图 Statechart Diagram
一.状态图(Statechart Diagram):用来描述一个特定的对象所有可能的状态,以及由于各种事件的发生而引起的状态之间的转移和变化. 一个机器的状态图: TIP:在需求分析和系统设计时都可以 ...