m*****g 发帖数: 71 | 1 只用constant内存的DP解法,自测能过所有test case
public boolean isDistanceZeroOrOne(IntFileIterator a, IntFileIterator b)
{
int up = 1;
int left = 1;
int diagnal = 0;
int dist = 0;
int currA = 0;
int currB = 0;
int prevA = 0;
int prevB = 0;
if (a.hasNext() && b.hasNext()) {
prevA = a.next();
prevB = b.next();
if (prevA == prevB) {
dist = 0;
} else {
... 阅读全帖 |
|
p*****y 发帖数: 529 | 2 那泥是具体怎么分解的?
假设q1=q2=q3=q4=1/2
then Marcov Matrix for 1D is:
..................................
....0 0 0 1/4 1/2 1/4 0 0 0 ......
....0 0 0 0 1/4 1/2 1/4 0 0 0 ....
....0 0 0 0 0 1/4 1/2 1/4 0 0 .....
........................................
right? 1/2是带在原地的概率,
1/4是往两边移动的概率,
All elements on diagnal are 1/2,
all elements on Sub-diagnal and super-diagonal are 1/4,
对x,y轴都是同样的Matrix,
但是现在的问题是这种情况下是无法禁止(1,1)-->(2,2)这种对角线的运动的,
而题目给定的是不允许这种运动.
如果泥能重设一个Matrix让两个方向的运动独立开那最好不过乐. |
|
e*******0 发帖数: 367 | 3 根据Robert Prechter,4浪1浪重叠的情况只发生在Diagnal Triangle 的情况,
diagnal triangle 只出现在大一级别浪的1,5浪,或4浪中的子浪。 |
|
H*M 发帖数: 1268 | 4 of course it is doable, and if you have a clear mind it is simple.
diagnal means: (left, upper)->(0,0) (right bottom)->(n,n)
then output: (0,0), (1,0),(0,1),(2,0),(1,1),(0,2)....
My point is: VERY FEW people can get the indexing correct in short time.
if you don't believe it, do it.
order? |
|
H*M 发帖数: 1268 | 5 I guess you are make it compliate
i just asked to write bug-free code to print the elements of maxtrix, diagna
l by diagnal;
no mathematics involved, even primary school student can do that
The point is bug free |
|
s*****e 发帖数: 36 | 6 C(101,2)^2 seems right. Found where I am wrong. A rectangle has four points.
The other diagnal pair can not form the same rectangle either. |
|
f*****e 发帖数: 2992 | 7 仍然用DP做:
好像是一个n by n的表,不用每个entry都算出来,只算t对角阵(t-diagnal),因为每
个元素只能用到另一个数组元素里面的2t个元素,比如A数组的长度为L1,B数组的长度
为L2,则A数组的ith元素x,只能用到B数组的[L2-(L1-i+1)-t,L2-(L1-i+1)+t]th元素。
如果超过这个范围,他右边的edit distance铁定超过t了。
所以... |
|
c*****a 发帖数: 808 | 8 練一下
//print matrix in diagnal
public static void printMat(int[][]mat){
for(int i =0;i
int temp = i, j =0;
while( i>=0 && j
System.out.print(mat[j++][i--] +" ");
i=temp;
System.out.println();
}
for(int i =1;i
int temp = i, j=mat[0].length-1;
while(i=0)
System.out.print(mat[i++][j--] +" "... 阅读全帖 |
|
f*****e 发帖数: 2992 | 9 来自主题: JobHunting版 - G 家面经 storm8的 online test 的升级版
for(int j = 0; j < m; j++) // row from bottom to top
for(int i = 0; i < n; i++) // column from left to right
for(int k = 0; k <=j; k++) // calculate diagnal '\' elements
dp2[i][j][i+k][j-k] = max{of the 4 combinations};
// k = 0 is what we want, other values of k are prepared for later
calculation of the 4 combinations (left, left), (left, down), (down, left),
(down, down)
O(n*(1+...+m))=O(nm^2)=O(MN*min(M,N)), m = min(M, N)
-------(i,j)-->-->-... 阅读全帖 |
|
f*****e 发帖数: 2992 | 10 来自主题: JobHunting版 - G 家面经 storm8的 online test 的升级版,3个循环搞定。
for(int j = 0; j < m; j++) // row from bottom to top
for(int i = 0; i < n; i++) // column from left to right
for(int k = 0; k <=j; k++) // calculate diagnal '\' elements
dp2[i][j][i+k][j-k] = max{of the 4 combinations};
// k = 0 is what we want, other values of k are prepared for later
calculation of the 4 combinations (left, left), (left, down), (down, left),
(down, down)
O(n*(1+...+m))=O(nm^2)=O(MN*min(M,N)), m = min(M, N)
-------(i,j... 阅读全帖 |
|
j*x 发帖数: 425 | 11 public class TicTacToe {
int[][] board;
int[] hScore;//horizontal
int[] vScore;//vertical
int[] dScore;//diagnal
public TicTacToe(int n){
board=new int[n][n];
hScore=new int[n];
vScore=new int[n];
dScore=new int[2];
}
public void addMove(char c,int i,int j){
board[i][j]=c;
int n=board.length;
if(c=='X'){
hScore[i]-=1;
vScore[j]-=1;
if(i==j) dScore[0]-=1;
if(... 阅读全帖 |
|
o**********7 发帖数: 242 | 12 昨天agent说如果是平行于两个房间的交接走向,比如客厅和厨房,就没问题。如果是
diagnal走向就不行。 |
|
x****u 发帖数: 12955 | 13 Get a piece of 2x6, rip it diagnally, lay the thick end against the garage
floor. |
|
m******0 发帖数: 222 | 14 补充一下,我这个说错了,不是calendar,而是diagnal,因为两条leg的strike不一样 |
|
|
g********s 发帖数: 1969 | 16 最近的Runner's World 有一篇他的专访。 Amazing!
It says, his biggest running achievements all have one thing in common -
world records.
Ultra trail Du Mont-Blanc, Frence
Corsica, Frence
Tahoe Rim Trail Record
Pyrenees, Spain
Mt. Sanitas, CO
Mt. Kilimanjaro, Tanzania
Grand Raid de La Reunion - Aka Diagnale des Fous, France |
|
h*d 发帖数: 19309 | 17 我有两个CRT,非纯平那个27"大概也就纯平那个27"一般的重量,另外计算了一下可视
面积,34" CRT大一倍也就50-50",在我的新家感觉也不是很大,刚买了个hdmi 5.1
receiver,把我老的receiver配的音响和in ceiling surround都接上感觉还不错。
下面是可视面积计算:
Width Height Diagnal Surface
4:3
27.2 20.4 34 554.88
16:9
44.417414 24.98479538 50.96220822 1109.76
16:9 as 4:3 如果节目两边是黑边
33.3130605 24.98479538 41.64132563 832.32
16:9 as 4:3 letter,最变态的情况,有很多广告是这样,可视面积只有原来的9/16
33.3130605 18.73859653 38.22165617 624.24 |
|
c******s 发帖数: 270 | 18 【 以下文字转载自 Quant 讨论区 】
发信人: JetMax (JetMax), 信区: Quant
标 题: A brain teaser question
发信站: BBS 未名空间站 (Sun Dec 16 14:03:40 2007)
Given a grid, each square in the grid has a light bulb and a button.
Everytime you press the button in a square, the light in this square and all
those in the immediately directly adjacent squares (i.e., the up, down,
left, and right squares; note that diagnally adjacent squares do not count)
are turned off. All lights are on initially.
Then question is: what is the minim |
|
c*******l 发帖数: 4801 | 19 比如BLOD--Backing line of dance
BDW--Backing Diagnal Wall
etc, etc |
|
M*****e 发帖数: 1827 | 20 "step out" means step forward, to the left, or diagnally to the left? |
|
n*s 发帖数: 752 | 21 i am not sure what u want to know
as for how to decomposite a rotation matrix into block diagnalized form, u can
find it in any advanced quantum mechanics books, such as Sakurai's Modern
Quantum Mechanics
topic |
|
a****n 发帖数: 20 | 22 assume a vector of size K ,e.g. [a, b, c, d ]
write code to generate all these corresponding vectors:
[a-1, b, c, d]
[a+1, b,c,d]
[a,b-1,c,d]
[a,b+1,c,d]
[a+1,b+1,c+1,d+1].
...
[a,b,c,d+1]
i.e. all the vectors neighboring to him (including diagnal).
Any simple way?
thanks |
|
b***k 发帖数: 2673 | 23 ☆─────────────────────────────────────☆
JetMax (JetMax) 于 (Sun Dec 16 14:03:40 2007) 提到:
Given a grid, each square in the grid has a light bulb and a button.
Everytime you press the button in a square, the light in this square and all
those in the immediately directly adjacent squares (i.e., the up, down,
left, and right squares; note that diagnally adjacent squares do not count)
are turned off. All lights are on initially.
Then question is: what is the minimum number of button-presses that |
|
e*******0 发帖数: 367 | 24 同意师傅的看法,繁杂的方法只会把自己绕进去。我也觉得波浪理论有其局限性,非要
把所有的浪都分清楚,实在没必要。
书的语言非常易懂,内容也不难掌握,。还是强调从波浪理论的几个基本假设(5浪升
,3浪跌,1,4不重合,3浪非最短)出发,判断当前股票运行的位置,根据可能的
情况决定未来的操作的方向。同时紧密结合Fibonacci序列来预测未来走向的理想价格
目标。(数列有时的确精确到了惊人的地步。我仔细研究一下苹果这次的顶,好像是两
个级别的五浪和更大级别的三浪结束点的重合,可以参考一下Ramki对AAPL浪的划
分)
除了基本原理外,还有一些细节问题,比如:diagnal triangle形态的特殊五升浪只能
出现在1,5浪;如果第5浪是扩展形态的话,随后的ABC调整浪很可能会调整到其
前序5浪的第2子浪附近,比如说现在的AAPL。这些理论还是比较有用的。
其实,最有把握操作的就是三浪,这个三浪的起点就是很多人所说的ABC pattern
。就是前一轮下跌走势在A点终结,B点超过前下跌的最后一个高点,随后C点不跌破
A点,其后的上升第3浪一般是1浪的1.618倍或以上,第五浪是1-3浪的 ... 阅读全帖 |
|