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 ...
随机推荐
- Maven Learning - Direct Dependencies & Transitive Dependencies
Dependencies declared in your project's pom.xml file often have their own dependencies. The main dep ...
- android 自定义日历控件
日历控件View: /** * 日历控件 功能:获得点选的日期区间 * */ public class CalendarView extends View implements View.OnTouc ...
- 理解TCP为什么需要进行三次握手(白话)
原文地址:http://www.cnblogs.com/yuilin/archive/2012/11/05/2755298.html 首先简单介绍一下TCP三次握手 在TCP/IP协议中,TCP协议提 ...
- Python一点注意
1. pickle pickle模块中的两个主要函数是dump()和load().dump()函数接受一个文件句柄和一个数据对象作为参数,把数据对象以特定的格式保存到给定的文件中.当我们使用load( ...
- [原]常用sqlserver数据库使用sql语句
1.表结构文档生成查询语句: SELECT 架构名 Then s.[name] Else '' End, 表名 Then D.name Else '' End, 表说明 Then isnull(F.v ...
- ionic hybrid备忘
ionic 是目前最有潜力的一款开源Hybrid( HTML5+css3+nodejs+Angularjs+PhoneGap)手机应用开发框架.通过 SASS 构建应用程序,它提供了很多 UI 组件来 ...
- 命令行下打WAR包
命令行下打WAR包: jar -cvf TestMem.war *
- QT编写DLL给外部程序调用,提供VC/C#/C调用示例(含事件)
最近这阵子,接了个私活,封装一个开发包俗称的SDK给客户调用,查阅了很多人家的SDK,绝大部分用VC编写,而且VC6.0居多,估计也是为了兼容大量的XP用户及IE浏览器,XP自带了VC6.0运行库,所 ...
- Approvals for EBS 1.4 Now Available
If you haven't been following the excellent Workflow blog, you might have missed the announcement ab ...
- 【转载】solr初体验
[1]http://cxshun.iteye.com/blog/1039445 由于工作原因,这段时间接触到solr,一个基于lucene的企业级搜索引擎.不怎么了解它的童鞋可以去GOOGLE一下. ...