由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Quant版 - An question(brainteaser)
相关主题
请问有谁参加 Constellation energy Third Round interview?Quant面试问题
[合集] 现在街上的面试已经有点走火入魔了一道比较有意思的题
[合集] 这道题怎么做?[合集] [brainteaser] CrazyRunning
请问个几何问题[合集] Anybody phone interviewed with DE Shaw before?
来一道题(由 BT question 而想) 2[合集] Anyone has experience with UBS phone interview?
一些算法题。[合集] phone interview brainteaser
Bloomberg developer 两道电面题目[合集] 请问citadel quant research电话面试可能面试什么?
找矿工的一些感想和经验-补充几点[合集] 面试问题(brainteaser)
相关话题的讨论汇总
话题: line话题: question话题: squares话题: cross
进入Quant版参与讨论
1 (共1页)
d****2
发帖数: 109
1
A n*m rectangular, draw one line connect two opposite vertex, e,g, (1,1) - (
n,m), how many small squares the
line will cross (cross means the line will be in the square, not on the edge
).
a**m
发帖数: 102
2
m+n-gcd(m,n)?

(
edge

【在 d****2 的大作中提到】
: A n*m rectangular, draw one line connect two opposite vertex, e,g, (1,1) - (
: n,m), how many small squares the
: line will cross (cross means the line will be in the square, not on the edge
: ).

t******y
发帖数: 1100
3
yes

【在 a**m 的大作中提到】
: m+n-gcd(m,n)?
:
: (
: edge

d****2
发帖数: 109
4
cool, how did you get it?

【在 a**m 的大作中提到】
: m+n-gcd(m,n)?
:
: (
: edge

r*******s
发帖数: 303
5
这条线穿过gcd(m,n)个交叉点。
a**m
发帖数: 102
6
first consider the case that gcd(m,n)=1:
Suppose n>=m, consider the intersections of the diagonal and the horizontal
lines, their coordinates are 0, m/n, 2m/n, ...,nm/n(=m).
if the open interval ((k-1)m/n, km/n) contains an integer, this means the
diagonal crosses 2 squares in the k-th row, otherwise it crosses only 1
square.
Note that the open interval can contain as many as one integer because n>=m.
We know that 1,2,...,m-1 will appear in some of the n open intervals, so
there are m-1 open int

【在 d****2 的大作中提到】
: cool, how did you get it?
p*****k
发帖数: 318
7
note the problem asks (1,1) instead of (0,0)
a simple fix though
d****2
发帖数: 109
8
good, thanks

horizontal
m.
contains

【在 a**m 的大作中提到】
: first consider the case that gcd(m,n)=1:
: Suppose n>=m, consider the intersections of the diagonal and the horizontal
: lines, their coordinates are 0, m/n, 2m/n, ...,nm/n(=m).
: if the open interval ((k-1)m/n, km/n) contains an integer, this means the
: diagonal crosses 2 squares in the k-th row, otherwise it crosses only 1
: square.
: Note that the open interval can contain as many as one integer because n>=m.
: We know that 1,2,...,m-1 will appear in some of the n open intervals, so
: there are m-1 open int

l******i
发帖数: 1404
9

惊见系里大师兄

【在 t******y 的大作中提到】
: yes
1 (共1页)
进入Quant版参与讨论
相关主题
[合集] 面试问题(brainteaser)来一道题(由 BT question 而想) 2
[合集] [brainteaser]X1, X2,...,Xn are independent random variables一些算法题。
[合集] Quant面试问题Bloomberg developer 两道电面题目
[合集] 一道比较有意思的题找矿工的一些感想和经验-补充几点
请问有谁参加 Constellation energy Third Round interview?Quant面试问题
[合集] 现在街上的面试已经有点走火入魔了一道比较有意思的题
[合集] 这道题怎么做?[合集] [brainteaser] CrazyRunning
请问个几何问题[合集] Anybody phone interviewed with DE Shaw before?
相关话题的讨论汇总
话题: line话题: question话题: squares话题: cross