摘要: 题目链接:http://codeforces.com/contest/934/problem/C 因为最后要找的是一段单调非减区间,所以最后形成的序列一定是11...12....22。中间有一个从1到2的断点。 现在要找一个区间反转,如果反转之后形成的序列的断点不在这个区间内,那么这次反转就没有任何 阅读全文
posted @ 2018-02-16 14:36 海哥天下第一 阅读(681) 评论(0) 推荐(0) 编辑
摘要: Edward is the headmaster of Marjar University. He is enthusiastic about chess and often plays chess with his friends. What's more, he bought a large d 阅读全文
posted @ 2018-02-08 21:49 海哥天下第一 阅读(141) 评论(0) 推荐(0) 编辑
摘要: Problem Description Hzz loves aeroplane chess very much. The chess map contains N+1 grids labeled from 0 to N. Hzz starts at grid 0. For each step he 阅读全文
posted @ 2018-02-08 17:40 海哥天下第一 阅读(120) 评论(0) 推荐(0) 编辑
摘要: Problem Description Akemi Homura is a Mahou Shoujo (Puella Magi/Magical Girl).Homura wants to help her friend Madoka save the world. But because of th 阅读全文
posted @ 2018-02-08 14:45 海哥天下第一 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Description Ivan is fond of collecting. Unlike other people who collect post stamps, coins or other material stuff, he collects software bugs. When Iv 阅读全文
posted @ 2018-02-07 23:33 海哥天下第一 阅读(141) 评论(0) 推荐(0) 编辑
摘要: Description Organizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually expect the contest 阅读全文
posted @ 2018-02-05 22:48 海哥天下第一 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 有2^n个人进行比赛,所以可以推出比赛共需要进行n轮,单独考虑第n轮中序号为i的人需要面对的潜在对手,将这些对手分别考虑。 转移方程为dp[i][j]+=dp[k][j-1]*dp[i][j-1]*a[i][k];即晋级的概率=∑(自己来到这一轮的概率*对手来到这一轮的概率*战胜对手的概率) 阅读全文
posted @ 2018-02-04 21:46 海哥天下第一 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 概率dp入门题,转移方程为dp[i]=dp[i-1]*p+dp[i-2]*(1-p) 因为n个数字上限很大,所以常规的概率dp基本不可能,要用矩阵优化。 把路程分成n+1段,分别计算通过每段的成功率,即刚好跨越地雷的概率(dp[地雷x+1]) 算好每段之后把每段的成功率相乘。 (若有两颗地雷相邻那么 阅读全文
posted @ 2018-02-04 18:52 海哥天下第一 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 矩阵快速幂模板(手撸一遍,一下午修改的头要爆炸了!!!!!!!) 果然是菜原罪╮(╯▽╰)╭ 阅读全文
posted @ 2018-02-04 18:46 海哥天下第一 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Description Imagine you are standing inside a two-dimensional maze composed of square cells which may or may not be filled with rock. You can move nor 阅读全文
posted @ 2018-01-22 17:25 海哥天下第一 阅读(195) 评论(0) 推荐(0) 编辑