cf D. Broken Monitor】的更多相关文章

http://codeforces.com/contest/370/problem/D 题意:输入一张图,上面只有两个字符'w'和‘.’ ,如果可以用一个正方形把所有的‘w’围起来,所有的‘w’都在正方形的边上.如果有多种输出最小的一个. 先预处理出[1,1]到[i,j]里面有多少个'w'存在dp[i][j]中.找到正方形的大小,然后枚举找左上角的点.就可以找到符合题意的正方形. #include <cstdio> #include <cstring> #include <a…
D. Broken robot 链接. 题意: 一个方格,从(x,y)出发,等价的概率向下,向左,向右,不动.如果在左右边缘上,那么等价的概率不动,向右/左,向下.走到最后一行即结束.求期望结束的步数. 分析: 因为不能往上走,所以行与行之间存在转移,即上一行转移到下一行. 同一行内的位置可以互相转移,所以可以对每一行内进行高斯消元,那么复杂度是$O(n^4)$,但是发现高斯消元的矩阵中每行只有三个位置有数,这个矩阵叫三对角矩阵,观察这个矩阵,发现可以O(n)消元.复杂度$O(n^2)$ 代码:…
D. Little Elephant and Broken Sorting 链接 题意: 长度为n的序列,m次操作,每次交换两个位置,每次操作的概率为$\frac{1}{2}$,求m此操作后逆序对的期望. 分析: f[i][j]表示i>i的概率,每次交换的概率为$\frac{1}{2}$,设交换的位置是x,y,那么$f[i][x]=\frac{f[i][x]+f[i][y]}{2}$,分别是不交换和交换后的概率的和除以2. 代码: #include<cstdio> #include<…
题目链接 水题依旧无法1Y. #include <cstdio> #include <iostream> #include <cmath> using namespace std ; #define LL __int64 LL gcd(LL a,LL b) { ?a:gcd(b,a%b); } int main() { LL a,b,x,y,t; LL str,end,mid; scanf("%I64d%I64d%I64d%I64d",&a,…
D. Monitor time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Recently Luba bought a monitor. Monitor is a rectangular matrix of size n × m. But then she started to notice that some pixels ce…
一.什么是Health Monitor ChecksHealth Monitor Checks能够发现文件损坏,物理.逻辑块损坏,undo.redo损坏,数据字典损坏等等.Health Monitor Checks产生结果报告,它包含了解决问题的办法. -----oracle另外一个坏块检查工具DBVERIFY 详见我的这篇文章:Oracle坏块验证工具:DBVERIFYhttp://blog.chinaunix.net/uid-23284114-id-3687810.html----- Hea…
Problem B Broken Keyboard (a.k.a. Beiju Text) You're typing a long text with a broken keyboard. Well it's not so badly broken. The only problem with the keyboard is that sometimes the "home" key or the "end" key gets automatically pres…
11988 - Broken Keyboard (a.k.a. Beiju Text) You’re typing a long text with a broken keyboard. Well it’s not so badly broken. The only problemwith the keyboard is that sometimes the “home” key or the “end” key gets automatically pressed(internally).Yo…
You're typing a long text with a broken keyboard. Well it's not so badly broken. The only problem with the keyboard is that sometimes the "home" key or the "end" key gets automatically pressed (internally). You're not aware of this iss…
问题:You’re typing a long text with a broken keyboard. Well it’s not so badly broken. The only problem with the keyboard is that sometimes the “home” key or the “end” key gets automatically pressed (internally). You’re not aware of this issue, since yo…