摘要: 【问题描述】 组合数 Cmn 表示的是从 n 个物品中选出 m 个物品的方案数。举个例子,从 (1,2,3) 三个物品中选择两个物品可以有 (1,2),(1,3),(2,3) 这三种选择方法。根据组合数的定 义,我们可以给出计算组合数的一般公式: Cnm=(n!m!)/(n−m)! 其中 n! = 阅读全文
posted @ 2017-11-10 14:42 qwerfcxs 阅读(291) 评论(0) 推荐(0) 编辑
摘要: 【问题描述】 本题中,我们将用符号 ⌊c⌋ 表示对 c 向下取整,例如: ⌊3.0⌋=⌊3.1⌋=⌊3.9⌋=3 。 蛐蛐国最近蚯蚓成灾了!隔壁跳蚤国的跳蚤也拿蚯蚓们没办法,蛐蛐国王只好去请神刀手来帮他们消灭蚯蚓。 蛐蛐国里现在共有 n 只蚯蚓( n 为正整数)。每只蚯蚓拥有长度,我们设第 ii 只 阅读全文
posted @ 2017-11-10 13:49 qwerfcxs 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 【问题描述】 对于刚上大学的牛牛来说,他面临的第一个问题是如何根据实际情况申请合适的课程。 在可以选择的课程中,有 2n 节课程安排在 n 个时间段上。在第 i(1≤i≤n) 个时间段上,两节内容相同的课程同时在不同的地点进行,其中,牛牛预先被安排在教室 ci 上课,而另一节课程在教室 di 进行。 阅读全文
posted @ 2017-11-10 11:30 qwerfcxs 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 【代码】 阅读全文
posted @ 2017-11-09 19:43 qwerfcxs 阅读(1331) 评论(0) 推荐(0) 编辑
摘要: 【问题描述】 还记得 NOIP 2012 提高组 Day2 中的借教室吗?时光飞逝,光阴荏苒,两年 过去了,曾经借教室的同学们纷纷归还自己当初租借的教室。请你来解决类似于 借教室的另一个问题。 在接受借教室请求的 n 天中,第 i 天剩余的教室为 ai 个。作为大学借教室服 务的负责人,你需要完成如 阅读全文
posted @ 2017-11-09 18:06 qwerfcxs 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 【问题描述】 求关于 x 的同余方程 ax≡1(mod b) 的最小正整数解。 【输入格式】 输入只有一行,包含两个正整数 a , b ,用一个空格隔开。 【输出格式】 输出只有一行,包含一个正整数 x0 ,即最小正整数解。输入数据保证一定有解。 【样例输入】 3 10 【样例输出】 7 【数据范围 阅读全文
posted @ 2017-11-09 10:46 qwerfcxs 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 【代码】 归并排序模板 阅读全文
posted @ 2017-11-09 09:24 qwerfcxs 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 【代码】 树状数组模板 cpp include include include include include include using namespace std; define f(i,n) for(int i=1;i 阅读全文
posted @ 2017-11-09 09:05 qwerfcxs 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 【代码】 KMP模板 cpp include include include include include include include using namespace std; define f(i,n) for(int i=1;i 阅读全文
posted @ 2017-11-09 08:45 qwerfcxs 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 【代码】 拓扑排序模板 阅读全文
posted @ 2017-11-09 08:43 qwerfcxs 阅读(143) 评论(0) 推荐(0) 编辑