URAL 1507. Difficult Decision(矩阵快速幂)...
分类:
其他好文 时间:
2015-03-28 10:12:14
阅读次数:
174
题意:
输入A矩阵,求出的B矩阵是否有0,有的话NO,没有YES。
做法:
矩阵快速幂,先算出 K等于n(n-1)次的A矩阵。复杂度 是 log(n^2)*(n^3)=10^4 ,然后k循环加到 n(n+1),每次把矩阵再乘个A,然后加到B里。复杂度是 n*n^3=10^6。所以妥妥的。因为只在乎有没有0,输入只有正数,矩阵里也只有乘法和加法。所以我把非零数改成了1,然后乘法用状压位运算优化到n^2。跑得稍微快点。...
分类:
其他好文 时间:
2015-03-28 10:10:13
阅读次数:
162
it's a dp difficult problem 试想如果我们遇见这样一道题,:有n道题目,每道题有一个得分v和用时t;我们要得够w分;用时最少 怎么做??这是一个裸奔的01背包如果多一个规则,每道题有一个开始时间,也就是开始做该题的时间不得少于一个时间st现在怎么做?我们应该把问题按照开始时...
分类:
其他好文 时间:
2015-03-18 13:53:51
阅读次数:
154
Operator Overload1.在重载下标运算符时(数组符号):不可重载为友元函数,必须是非static类的成员函数。why2.overload++时,如果是:inta;++a;++在前面时,怎么办?答:countercounter::operator++(int)3.classF{publi...
分类:
编程语言 时间:
2015-03-17 19:54:48
阅读次数:
173
I figured I’d do a quick tutorial about something a little more difficult, but still very important. I’m going to take you step-by-step through integr...
DescriptionRailway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue…The Lunar New Year ...
分类:
其他好文 时间:
2015-03-10 21:07:13
阅读次数:
160
DescriptionThe island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. T...
分类:
其他好文 时间:
2015-03-08 15:37:20
阅读次数:
135
本章讲述了栈、队列、树、指针、对象的基本实现。boring AND difficult!!!(1) 栈概念定义:栈属于动态集合,采用先进后出策略(LIFO)。基本操作是压入(PUSH)和弹出(POP)。如果s.top=0,表示栈空,如果试图对空栈进行POP操作会发生下溢(underflow)。如果s...
分类:
其他好文 时间:
2015-02-23 13:06:06
阅读次数:
282