Redian新闻
>
piecemeal 法案明显是共和党自己找个墙骑一下而已
avatar
piecemeal 法案明显是共和党自己找个墙骑一下而已# EB23 - 劳工卡
S*g
1
【 以下文字转载自 Military 讨论区 】
发信人: StephenKing (金博士), 信区: Military
标 题: Re: 今天给人割草,赔了1950美元
发信站: BBS 未名空间站 (Sun Apr 23 21:28:10 2017, 美东)
最早的那个StephenKing在2011年就海归了。
http://www.mitbbs.com/pc/pccon.php?id=7243&nid=194071
买买提的最后一贴 by SK
发表时间:2011-11-24
这是我在买买提的最后一贴。
想了很久,就发在军版吧。
既然要走了,就跟买提的朋友们说几句真心话,作为告别。
我知道很多人猜我是站方雇的。其实不是。我是志愿军,人民的。
还有,我是女生,不到30岁,博士毕业不久。给PhD老板做了几个月博后,过渡一下。
回去是因为有个还不错的offer。另外一个更重要的原因是未婚夫在国内,他不愿意出
来。
我是理科生,本科生物,现在做bioinformatics,不过我从小就喜欢写作。有时候写着
写着,也会把自己写糊涂。
我不姓金,SK算是我的笔名。我也没有经历过六四。Well,六四那年,我六岁。
我不是老将,只是觉得这里老将势弱,友情支持一下。被我“追杀”过的小将们,请不
要介怀。我记得有一个小将被我吓得不敢再上买提了,还给我写了保证书,当时觉得好
笑的紧,罪过罪过。
我的老板系列,来源于生活。我的确有一个女老板,单身,今年36-7岁(我猜的,从来
没问过。)。这个年龄从婚恋上讲,正是尴尬的年龄。她对学生,尤其是女学生,出乎
意料的好。但她在学术上,比较严厉。我侥幸发了三篇很好很好的paper,都是第一作
者,虽然老板亲自处理了大部分的文字。在博客里,我放肆地编排了一些她的轶事,也
有把别人的栽到她身上。好在她读不懂中文。有一次中饭她来找我要一张图,我正把买
提开着,正写到“我代表人民处决你”那一段。可把我的小心肝吓得噗噗直跳。
对了,我不是南开的。我毕业于top 2中的一所。
这位朋友,你看完了,要是能帮我转到一个你最喜欢的版面,就太谢谢了。
我在买买提混了这么久,就用这个方式向大家告别吧。
我们后会有期。
avatar
j*y
2
1. How to print out Pascal's Triangle?
2. Two integers given, N and M. Suppose M = 10101 (binary system), write
code to change N's 2nd to 6th bits to M.
For example, N = 100001000, M = 10101, the result is expected to be
101010100.
Got stuck with these two questions during interview. Frustrated...
Please help, thanks!
avatar
r*o
3
看到大家经常写四星,五星什么的。都是在哪儿看得呢?
avatar
y*i
4
HOUSE 共和党的回旋余地没有SENATE 的大,他们很容易被自己党内极端保守派搞下台
,所以不可能向参议院那么积极。但同时又不能显得太保守,让民主党在移民上得分太
多,所以搞出这个piecemeal。
对两方都有交代(1)对保守派来说,HOUSE 版本没有大赦,参议院不通过的话,众议
院没有什么政治后果。(2)对墨西哥移民来说,HOUSE 至少迎合了移民呼声,如果参
院通过,投降起来也很顺利。
如果HOUSE R们那么坚决反对的话,根本不需要提任何移民法案,因为反移民那帮人最
大呼声就是enforce current law。piecemeal 法案出台,大家都知道共和党是在骑墙
了,而且参议院通过的可能性很大,所以我觉得共和党高层是准备投降了。
另外,Rubio 可能还不愿意这个法案过得太顺利呢,现在这个状态对他最有利,因为八
人帮里他最关键,出镜率最高。如果法案水过,他还怎么邀功?看他的劲头,野心应该
是参选2016。
avatar
g*e
5
想了一下才想起来帕斯卡三角... a_i = C(n,i) 知道这个就好算了
第二题没看懂啥意思

【在 j***y 的大作中提到】
: 1. How to print out Pascal's Triangle?
: 2. Two integers given, N and M. Suppose M = 10101 (binary system), write
: code to change N's 2nd to 6th bits to M.
: For example, N = 100001000, M = 10101, the result is expected to be
: 101010100.
: Got stuck with these two questions during interview. Frustrated...
: Please help, thanks!

avatar
r*n
6
每个州不一样 ,有的州没有评级,有的州打分,有的州给星级。全国没有统一标准。
however
NAEYC 会根据他们的标准进行他们的认证,他们的认证标准比较统一,可以去NAEYC网
站上搜索你们当地有没有被认证的preschool 或者daycare。通过认证的质量一般都还
不错。

【在 r*******o 的大作中提到】
: 看到大家经常写四星,五星什么的。都是在哪儿看得呢?
avatar
k*o
7
我也这样想,
不过政客们说话都说得太婉转了,
不到最后时刻翻牌,也不知道结果。
小团体们各有各的打算,应该不会这样容易妥协
avatar
r*y
8
#2, if we know how many bits of N, then it is a little simple, say n bits
in N
let N1 = N << 7
N1 = N1 >> 7
N2 = N >> n -2
N2 = N1 << n- 2
N3 = M << n - 7
after the replacement, the New N = N1 + N2 + N3

【在 j***y 的大作中提到】
: 1. How to print out Pascal's Triangle?
: 2. Two integers given, N and M. Suppose M = 10101 (binary system), write
: code to change N's 2nd to 6th bits to M.
: For example, N = 100001000, M = 10101, the result is expected to be
: 101010100.
: Got stuck with these two questions during interview. Frustrated...
: Please help, thanks!

avatar
c*n
9
I don't think LZ's example is appropriate.
I think the result should be 100101010. (2nd~6th bit change to M, from left
to right)
if M is constant, let say # of bits of M is 5 (10101)
then we can do
N = (N&1) | ( ((N>>6)| M ) << 1 )
avatar
F*r
10
1. DP
2. (~k)&N|(M<<2) where k = (1<<7)-(1<<2);

【在 j***y 的大作中提到】
: 1. How to print out Pascal's Triangle?
: 2. Two integers given, N and M. Suppose M = 10101 (binary system), write
: code to change N's 2nd to 6th bits to M.
: For example, N = 100001000, M = 10101, the result is expected to be
: 101010100.
: Got stuck with these two questions during interview. Frustrated...
: Please help, thanks!

avatar
j*y
11
Sorry, forgot to mention that the rightmost bit is bit 0.
avatar
j*y
12

Could you explain the steps in 2? It looks so formidable.

【在 F**r 的大作中提到】
: 1. DP
: 2. (~k)&N|(M<<2) where k = (1<<7)-(1<<2);

avatar
v*n
13
Which company? 以前英伟达问过我这个
avatar
j*y
14
EFI
avatar
j*y
16
Which entry is it in Bit Twiddling Hack?
avatar
j*y
17

What a shame! I forgot middle-school mathematics. Binomial expansion. I am a
fucking big fat loser.

【在 g**e 的大作中提到】
: 想了一下才想起来帕斯卡三角... a_i = C(n,i) 知道这个就好算了
: 第二题没看懂啥意思

avatar
m*2
18
pascal triangle 需要DP吗??

【在 F**r 的大作中提到】
: 1. DP
: 2. (~k)&N|(M<<2) where k = (1<<7)-(1<<2);

avatar
c*n
19
Oh, so we should know the # of bits of N first.
T = N
L = 0
while( (T>>=1) > 0) ++L;
N = ( N ^ ~(1<> (L-6)) | M ) << (L-6))
//keep the tailing bits set M
N = 100001000, M = 10101
L = 8 (the rightmost bit is 0th)
first keep the tailing bits:
~(1<<3) = 11
N^11 = 00
set M:
N >> 2 = 1000010
1000010 | M = 1010101
1010101 << 2 = 101010100
101010100 | 00 = 101010100

【在 j***y 的大作中提到】
: Sorry, forgot to mention that the rightmost bit is bit 0.
avatar
F*r
20
DP is ubiquitous. I didn't see any other method is better than DP for this
problem "print out Pascal's Triangle".

【在 m*********2 的大作中提到】
: pascal triangle 需要DP吗??
avatar
j*y
21
1 << 3 == 1000 ~(1 << 3) = ~1000 = 0111, isn't it?
avatar
j*y
22

Could you give a sample code to print it using DP? I am not familiar with DP
at all, let alone coding with it.
By the way, what entry in Bit Twiddling Hack does your solution to Problem 2
fall onto?
Thanks!

【在 F**r 的大作中提到】
: DP is ubiquitous. I didn't see any other method is better than DP for this
: problem "print out Pascal's Triangle".

avatar
m*2
23
2.
应该可以。。
我的想法是
k&N|(M<<2) where
k = (0<<6 | (1 << 3) - 1)

【在 F**r 的大作中提到】
: 1. DP
: 2. (~k)&N|(M<<2) where k = (1<<7)-(1<<2);

avatar
j*y
24

Could you elaborate on the logic of your solution?
By the way, isn't 0<<6 still 0?
1<<3 is 1000 (binary), 1000 -1 = 0111.
So, that is 0<<7?

【在 m*********2 的大作中提到】
: 2.
: 应该可以。。
: 我的想法是
: k&N|(M<<2) where
: k = (0<<6 | (1 << 3) - 1)

avatar
F*r
25
int *p1, *p2;
initialize p1, p2;
for(i=0; istd::cout<<1<for(j=1; j<=i; j++) {
std::cout<}
swap(p1, p2);
cout<}
it tell you the idea, not an solution for a particular problem.

DP
2

【在 j***y 的大作中提到】
:
: Could you elaborate on the logic of your solution?
: By the way, isn't 0<<6 still 0?
: 1<<3 is 1000 (binary), 1000 -1 = 0111.
: So, that is 0<<7?

avatar
j*y
26
My solution:
M << 2 first, to move the binary numbers into bit 2~6.
Then if we can clear bits 2~6 in N, say the cleared N is N1, then what left
is to do N1 | M<<2.
But how to clear bits 2~6 in N? It seems N & ~1111100 can do it.
So, could it be done with (N & (~1111100)) | M<<2?
It looks quite clumsy and awkward.
avatar
m*l
27
... if you call this a DP...
kinda? a little?

【在 F**r 的大作中提到】
: int *p1, *p2;
: initialize p1, p2;
: for(i=0; i: std::cout<<1<: for(j=1; j<=i; j++) {
: std::cout<: }
: swap(p1, p2);
: cout<: }

avatar
j*y
28

It seems p1 and p2 are pointing to two consecutive memory areas respectively, aren't they? For examle, p1 = (int *) calloc(N * sizeof(int)), p2 = ... (similar).
p2[j] = p1[j] + p1[j-1], this I can understand. Except for the outmost
elements, every element is the sum of two neighboring elments in the above
layer. And I also noted that in every row, the column number is equal to row+1, if row starts with 0.
Why swap the two pointers here? Can't understand here...

【在 F**r 的大作中提到】
: int *p1, *p2;
: initialize p1, p2;
: for(i=0; i: std::cout<<1<: for(j=1; j<=i; j++) {
: std::cout<: }
: swap(p1, p2);
: cout<: }

avatar
z*z
29
queue for 1 question
YANGHUI(int n) {
1. Queue q; q.makeempty();
2. q.enqueue(1);q.enqueue(1);
3. int s = 0;
4. for(i=1;i<=n; i++) {
5. cout << endl;
6. q.enqueue(0);
7. for(int j = 1; j<=i+2; j++) {
8. int t = q.dequeue();
9. q.enqueue(s+t);
10. s = t;
11. if(j!=i+2) cout << s << " ";
}
}
}
avatar
s*y
30
You sure this works?
My code, generate up to level 10. Verify on Visual Studio:
int p1[20];
memset(p1, 0, 20*4);
p1[0] = 1;
for(int i=0; i<10; i++) {
int next = 0;
int prev = 0;
for (int j = 0; j < i+1; j++) {
if (j == 0) {
p1[j] = 1;
prev = 1;
} else if (j == i) {
p1[j] = 1;
} else {
next = p1[j];
p1[j] += prev;
prev = next;
}
cout << p1[j] << " ";
}
cout << endl;
}
result:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
1 9 36 84 126 126 84 36 9 1

【在 F**r 的大作中提到】
: int *p1, *p2;
: initialize p1, p2;
: for(i=0; i: std::cout<<1<: for(j=1; j<=i; j++) {
: std::cout<: }
: swap(p1, p2);
: cout<: }

avatar
F*r
31
two key attributes for DP, optimal substructure and overlapping
subproblems. tell why this is not DP?

【在 m********l 的大作中提到】
: ... if you call this a DP...
: kinda? a little?

avatar
j*y
32

Wow, nice and simple, this I can understand. Thanks a lot!

【在 s*****y 的大作中提到】
: You sure this works?
: My code, generate up to level 10. Verify on Visual Studio:
: int p1[20];
: memset(p1, 0, 20*4);
: p1[0] = 1;
: for(int i=0; i<10; i++) {
: int next = 0;
: int prev = 0;
: for (int j = 0; j < i+1; j++) {
: if (j == 0) {

avatar
j*y
33

Guess your swap() here actually means p1 = p2, while p2 needs to be re-
computed for the next new row (p1 points to the last row). Am I right?

【在 F**r 的大作中提到】
: int *p1, *p2;
: initialize p1, p2;
: for(i=0; i: std::cout<<1<: for(j=1; j<=i; j++) {
: std::cout<: }
: swap(p1, p2);
: cout<: }

avatar
j*y
34
回到家了,拒信也到email信箱了,郁闷。
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。