Redian新闻
>
做结构(桥梁)的回国是不是没啥前途?
avatar
做结构(桥梁)的回国是不是没啥前途?# CivilEngineering - 土木工程
s*u
1
诚聘住家保姆,我们住在tysons corner边上, mclean,VA。 保姆照顾一个月大的宝
宝,以及简单家务, 最好能长期做的。待遇从优。
请电话571-419-3820 或者发邮件到y*******[email protected]
avatar
e*d
2
Problem:
Given a n-step ladder, we can climb 1 or 2 steps each time. Please print out
all possible climbing ways to reach step-n.
For example n = 3; the output should be
1 2
1 1 1
2 1
My solution is attached in the end. Could you please help me improving the
code.
Thank you a lot.
=======================================
void printFioStep(int n)
{
assert(n > 0);

if( n == 1)
{
printf("%d \n", n);
return;
}
else if(n == 2)
{
printf("%d %d \n", 1, 1);
printf("%d \n
avatar
B*i
3
去一些大公司会好点吗?象 TY LIN.
美国做到SENIOR好象到头了,10万封顶,这辈子就这样了。
avatar
p*r
4
呵呵,这题应该用DP,从后往前推
慢慢想想吧。。。

out
the

【在 e******d 的大作中提到】
: Problem:
: Given a n-step ladder, we can climb 1 or 2 steps each time. Please print out
: all possible climbing ways to reach step-n.
: For example n = 3; the output should be
: 1 2
: 1 1 1
: 2 1
: My solution is attached in the end. Could you please help me improving the
: code.
: Thank you a lot.

avatar
Z*g
5
炒股?

【在 B***i 的大作中提到】
: 去一些大公司会好点吗?象 TY LIN.
: 美国做到SENIOR好象到头了,10万封顶,这辈子就这样了。

avatar
X*r
6
I didn't look closely at your code, but it seems way too complicated
at first glance. Why don't you just use recursion? The code should be
very simple, like:
void printStepsImpl(int x[], int k, int n) {
if (n--) {
x[k] = 1;
printStepsImpl(x, k+1, n);
if (n--) {
x[k] = 2;
printStepsImpl(x, k+1, n);
}
} else {
int i;
for (i = 0; i < k; i++) {
printf("%d ", x[i]);
}
printf("\n");
}
}
void printSteps(int n) {
int x[n]; // gcc extension, or t

【在 e******d 的大作中提到】
: Problem:
: Given a n-step ladder, we can climb 1 or 2 steps each time. Please print out
: all possible climbing ways to reach step-n.
: For example n = 3; the output should be
: 1 2
: 1 1 1
: 2 1
: My solution is attached in the end. Could you please help me improving the
: code.
: Thank you a lot.

avatar
B*i
7
你在炒吗?战果如何?

【在 Z****g 的大作中提到】
: 炒股?
avatar
z*e
8
红猪侠是不是搞竞赛出身的?
家里是不是教育工作者知识分子家庭啊?

【在 X****r 的大作中提到】
: I didn't look closely at your code, but it seems way too complicated
: at first glance. Why don't you just use recursion? The code should be
: very simple, like:
: void printStepsImpl(int x[], int k, int n) {
: if (n--) {
: x[k] = 1;
: printStepsImpl(x, k+1, n);
: if (n--) {
: x[k] = 2;
: printStepsImpl(x, k+1, n);

avatar
Z*g
9
奎费了

【在 B***i 的大作中提到】
: 你在炒吗?战果如何?
avatar
X*r
10
这个也能看出来吗?说说看你为什么这么认为。

【在 z****e 的大作中提到】
: 红猪侠是不是搞竞赛出身的?
: 家里是不是教育工作者知识分子家庭啊?

avatar
z*e
11
我是真相帝啊。哈哈哈。见多识广吧?

【在 X****r 的大作中提到】
: 这个也能看出来吗?说说看你为什么这么认为。
avatar
z*e
12
有时候我也很佩服自己的这个能力。

【在 X****r 的大作中提到】
: 这个也能看出来吗?说说看你为什么这么认为。
avatar
X*r
13
你去当程序员太可惜了。
说说看怎么看出来的?

【在 z****e 的大作中提到】
: 有时候我也很佩服自己的这个能力。
avatar
z*e
14
我也不知道具体,就是一种直觉。
并没有过详细的推理,但是今天看到你那个回帖,正在研读的时候,突然一道灵光照下
,这个论断赫然出现在我的脑海,并且让我坚定的相信。于是就写了下来。
据我妈说,当年我爷爷去世前一天,我还只有3岁好像,不记事的年纪。大家都在周围
照顾,我突然和家里人说,爷爷上天了。结果的二天,老人家就去世了。
可是当时也没人交给我说,上天就是去世死亡的意思。

【在 X****r 的大作中提到】
: 你去当程序员太可惜了。
: 说说看怎么看出来的?

avatar
z*e
15
以前也是,大学的时候,经常梦见和一堆不认识的老外说话,结果就糊里糊涂的出国了。
目前还没有梦见找到工作,估计等梦见了,就快了。
avatar
S*g
16
I guess more than 50% of this BBS's ID had some experience in competition at
some point.
Similar for the 2nd point.

【在 z****e 的大作中提到】
: 红猪侠是不是搞竞赛出身的?
: 家里是不是教育工作者知识分子家庭啊?

avatar
z*e
17
通过竞赛能直接到全国重点大学,或者大学以后去得国际竞赛成绩的,
家里是教授或者职业教师的,
应该是很少的。

at

【在 S*********g 的大作中提到】
: I guess more than 50% of this BBS's ID had some experience in competition at
: some point.
: Similar for the 2nd point.

avatar
t*t
18
搞竞赛!=通过竞赛直接到全国重点大学吧.
家里是职业教师的或许不多, 不过家里是知识分子的应该很多才对.

【在 z****e 的大作中提到】
: 通过竞赛能直接到全国重点大学,或者大学以后去得国际竞赛成绩的,
: 家里是教授或者职业教师的,
: 应该是很少的。
:
: at

avatar
r*t
19
梦到哪个队拿冠军了没(世界乒)?

了。

【在 z****e 的大作中提到】
: 以前也是,大学的时候,经常梦见和一堆不认识的老外说话,结果就糊里糊涂的出国了。
: 目前还没有梦见找到工作,估计等梦见了,就快了。

avatar
z*e
20
突然想起来,
你那句gcc extension。。。
为什么x[n]好像是动态确定的呢?
你那个extension是说什么意思?

【在 X****r 的大作中提到】
: I didn't look closely at your code, but it seems way too complicated
: at first glance. Why don't you just use recursion? The code should be
: very simple, like:
: void printStepsImpl(int x[], int k, int n) {
: if (n--) {
: x[k] = 1;
: printStepsImpl(x, k+1, n);
: if (n--) {
: x[k] = 2;
: printStepsImpl(x, k+1, n);

avatar
X*r
21
在栈上的动态长度数组是不符合C语言(C89)的规定的,但是gcc扩展了C语言,
允许这个。我就偷懒用了。

【在 z****e 的大作中提到】
: 突然想起来,
: 你那句gcc extension。。。
: 为什么x[n]好像是动态确定的呢?
: 你那个extension是说什么意思?

avatar
r*t
22
C99 里面是有动态长度数组的,大部分 compiler 也支持,是不是 c++ 里面是不合法
的?必须用
vector? 不用动态长度数组写程序很麻烦啊,很多问题需要动态长度数组。

【在 X****r 的大作中提到】
: 在栈上的动态长度数组是不符合C语言(C89)的规定的,但是gcc扩展了C语言,
: 允许这个。我就偷懒用了。

avatar
r*t
23
ft, 正说这个呢,我的 compiler 就不支持,只能用 C90, 太麻烦了。

【在 r****t 的大作中提到】
: C99 里面是有动态长度数组的,大部分 compiler 也支持,是不是 c++ 里面是不合法
: 的?必须用
: vector? 不用动态长度数组写程序很麻烦啊,很多问题需要动态长度数组。

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