摘要: B. Infinite Maze time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output We've got a rectangular 阅读全文
posted @ 2016-08-07 13:57 Cumulonimbus 阅读(407) 评论(0) 推荐(0) 编辑
摘要: ->题目链接 定义一个数组dp,dp[ i ][ j ]表示以数值 i 结尾的、长度为 j 的good序列。 容易知道dp[ i ][1](1≤i≤n) 为1。 每求得一个 i,j 对应的dp[ i ][ j ],就把这个值加在 dp[ p*i ][ j+1 ],dp[ p*i ][ j+2 ],… 阅读全文
posted @ 2016-08-05 14:23 Cumulonimbus 阅读(128) 评论(0) 推荐(0) 编辑
摘要: ->题目链接 可以用动态解决问题,题目求的是最少的休息天数,我们可以通过求最大的工作天数来的得到答案。 用数组dp[ i ][ j ]记录到第 i 天为止Vasya最大的工作天数,j 的定义如下, 对于第 i 天 , • j=0,表示Vasya第 i 天休息,dp[ i ][0]就表示如果第 i 天 阅读全文
posted @ 2016-08-05 11:17 Cumulonimbus 阅读(202) 评论(0) 推荐(0) 编辑
摘要: lines Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1650 Accepted Submission(s): 684 Problem De 阅读全文
posted @ 2016-08-01 18:47 Cumulonimbus 阅读(175) 评论(0) 推荐(0) 编辑
摘要: A. Codeforces 689A Mike and Cellphone 1 #include <iostream> 2 #include <algorithm> 3 #include <map> 4 #include <vector> 5 #include <functional> 6 #inc 阅读全文
posted @ 2016-07-29 15:31 Cumulonimbus 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 题目链接: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1136 分析见《算法竞赛入门经典-训练指南》P190 阅读全文
posted @ 2016-07-24 10:44 Cumulonimbus 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 题目链接: http://poj.org/problem?id=3735 一开始的想法是建立两个(n+1)*(n+1)的矩阵A,对角线均为1,其他元素初始为0,另一个(n+1)*1的矩阵B,对于元素(b i1) ∈ B,1<= i <=n(矩阵元素坐标在讨论中均以1开始),表示第 i 只猫的花生个数 阅读全文
posted @ 2016-07-23 16:07 Cumulonimbus 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 奥运 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2926 Accepted Submission(s): 739 Problem Descr 阅读全文
posted @ 2016-07-23 12:47 Cumulonimbus 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 设g(x)为n=x时的调用次数,有Fabonacci数列递推式可以得到 g(x)=g(x-1)+g(x-2)+1,(f(x)要调用一次,所以要加1)。 转换为矩阵形式 即, g(1)和g(0)均为1。 使用矩阵快速幂计算结果。 1 #include <iostream> 2 #include <al 阅读全文
posted @ 2016-07-22 18:42 Cumulonimbus 阅读(237) 评论(0) 推荐(0) 编辑
摘要: Problem 1683 纪念SlingShot Accept: 561 Submit: 1969Time Limit: 1000 mSec Memory Limit : 32768 KB Accept: 561 Submit: 1969Time Limit: 1000 mSec Memory Li 阅读全文
posted @ 2016-07-22 17:21 Cumulonimbus 阅读(237) 评论(0) 推荐(0) 编辑