由买买提看人间百态

topics

全部话题 - 话题: newline
1 2 下页 末页 (共2页)
l*********r
发帖数: 674
1
【 以下文字转载自 Database 讨论区 】
发信人: luckyseeker (lucky), 信区: Database
标 题: 问一个xml的newline的问题
发信站: BBS 未名空间站 (Sat Jan 3 19:06:07 2009)
在html里面,用
就可以把下面的内容display在new line。xml有类似的东西换行么
P********e
发帖数: 2610
2
到XML版去问
XML是纯DATA,并不实现你要的东西
不过,你可以用
这个可以实现newline
A******a
发帖数: 61
3
【 以下文字转载自 Linux 讨论区 】
发信人: Ataraxia (静), 信区: Linux
标 题: how to use grep/sed to remove newlines?
发信站: BBS 未名空间站 (Sat Oct 18 10:48:52 2008)
i am trying grep some text from a file then return some words:
grep "^>start" textfile.txt
but it always returns results one each line:
A
B
C
I want to have it as: A B C ..., so I tried to use sed:
grep "^>start" textfile.txt | sed -e 's/\n//'
it doesn't work, anyone knows how to solve this?
Thanks.
m*****e
发帖数: 4193
4
来自主题: Linux版 - emacs: indent after a newline
For example, if I write the following source code:
1: int main()
2: {
3: >>
4: }
Say I press enter after line 2, the cursor should stop with indentation at
line 3. But it's not the case right now. It starts at column 0 until I press
enter again, in which case it then indents correctly.
Is there a way to indent immediately after a newline?
c*********s
发帖数: 63
5
终于弄好了。把下面的存成.bst文件,和Tex文件放在同一个文件夹就可以了。
%%
%% This is file `cellnew.bst',
%% generated with the docstrip utility, by HJ, 03/03/2013.
%%
%% The original source files were:
%%
%% merlin.mbs (with options: `ay,nat,nm-rvvc,nmlm,x10,x0,m10,m0,mcite,mct-1
,mct-x2,keyxyr,blkyear,dt-beg,yr-par,note-yr,atit-u,jttl-rm,thtit-a,vol-it,
vnum-x,volp-com,pp-last,num-xser,jnm-x,btit-rm,bt-rm,add-pub,pub-par,pre-pub
,edby,edbyy,blk-tit,ppx,ed,abr,ednx,xedn,jabr,url,url-blk,em-it,nfss,')
%% ----------------------... 阅读全帖
c*********s
发帖数: 63
6
终于弄好了。把下面的存成.bst文件,和Tex文件放在同一个文件夹就可以了。
%%
%% This is file `cellnew.bst',
%% generated with the docstrip utility, by HJ, 03/03/2013.
%%
%% The original source files were:
%%
%% merlin.mbs (with options: `ay,nat,nm-rvvc,nmlm,x10,x0,m10,m0,mcite,mct-1
,mct-x2,keyxyr,blkyear,dt-beg,yr-par,note-yr,atit-u,jttl-rm,thtit-a,vol-it,
vnum-x,volp-com,pp-last,num-xser,jnm-x,btit-rm,bt-rm,add-pub,pub-par,pre-pub
,edby,edbyy,blk-tit,ppx,ed,abr,ednx,xedn,jabr,url,url-blk,em-it,nfss,')
%% ----------------------... 阅读全帖
c*******a
发帖数: 1879
7
来自主题: Military版 - 大哥语法都是这么定义的
Grammar
atom ::=
identifier | literal | enclosure

enclosure ::=
parenth_form | list_display
| generator_expression | dict_display
| string_conversion | yield_atom
literal ::=
stringliteral | integer | longinteger
| floatnumber | imagnumber
stringliteral ::=
stringliteralpiece
| stringliteral stringliteralpiece
parenth_form ::=
"(" [expression_list] ")"
list_display ::=
... 阅读全帖
i**********e
发帖数: 1145
8
来自主题: JobHunting版 - 问道 facebook 面试题
其实不递归 代码或许会更简单些
void outputJSon(istream &in) {
bool newLine = false;
bool inBracket = false;
int indentLevel = 0;
while (in) {
char c = in.get();
if (newLine) {
cout << endl << setw(indentLevel) << c;
newLine = false;
}
else {
cout << c;
}
if (c == '{') {
indentLevel += TAB_SPACE;
newLine = true;
} else if (!inBracket && c == ',') {
newLine = true;
} else if (c == '}') {
newLine = true;
} else if (c == '[') {
... 阅读全帖
l*****g
发帖数: 685
9
来自主题: JobHunting版 - an interview question
Good question!
I was wrong. It's not really a BST, but rather a BT.
The nodes don't have explicit keys, and line numbers are implied by the in-
order traveral of the tree. Each node holds prevCount, number of all lines
before it, and nextCount, number of all lines after it.
Here is a rough implementation of this idea.
class Line
{
public:
//char * text;
Line * prev;
Line * next;
int prevCount;
int nextCount;
Line(char * text)
{
// clone text data
prev ... 阅读全帖
l********a
发帖数: 1154
10
来自主题: CS版 - 用Python读csv文件header?
py3k和py2.x的文档来看就一个差别:
py3k:
"...If csvfile is a file object, it should be opened with newline=''.[1]"
[1] If newline='' is not specified, newlines embedded inside quoted fields
will not be interpreted correctly, and on platforms that use \r\n linendings
on write an extra \r will be added. It should always be safe to specify
newline='', since the csv module does its own (universal) newline handling.
py2.x:
"...If csvfile is a file object, it must be opened with the ‘b’ flag on
platforms where tha... 阅读全帖
r****r
发帖数: 159
11
来自主题: JobHunting版 - 求解一道题 思路也好
ReplacementGrammar
Problem:
You will receive a message that must be translated by several string
replacement rules. However, the exact replacement rules are not fixed - they
will be provided as part of the input. You are to write a program that
receives a list of string replacements rules followed by a message, and
outputs the translated message.
Details:
0) A 'newline' consists of a carriage feed 'r' followed by a line feed 'n'.
1) The input will begin with any number of 'string replacement rul... 阅读全帖
z****n
发帖数: 1379
12
来自主题: JobHunting版 - 求教一道经典面题的解法
complete binary tree才能用1, 2, 4, 8
从顶上开始打印的话,再将root放入queue后,放一个newline的标志进入queue(比如一
个特殊node),以后循环处理queue的时候,遇到这个newline标志就打印个newline,然
后把这个newline标志重新放入queue(这时它出现在queue最后,表示下一次要打印new
line的时候)

line
T*******n
发帖数: 493
13
Depending on whether you want to preserve line justification
within the cell, you can use either \linebreak (justification)
or \newline (no justification). Run the example below for
illustration.
\usepackage{array}
\begin{tabular}{|p{1in}|p{1in}|p{1in}|}
\hline
one two three four five six seven eight nine ten &
one two three\linebreak
four five\linebreak
six seven eight\linebreak
nine ten &
one two three\newline
four five\newline
six seven eight\newline
nine ten \\
\hlin
D****6
发帖数: 278
14
来自主题: JobHunting版 - 求教一道经典面题的解法
这个不太对吧, 每次add newline时是针对这个current node, 不是这个current level
, 所以还是需要1,2,4,8来分辨什么时候打newline. 不complete 也可以, 就需要把
null children也要add到queue里. 然后每次看到null就只是count++, continue.
我刚开始也push newline into the queue, then realize doesn't work!

如一
,然
new
l**o
发帖数: 3
15
来自主题: Database版 - help on store procedure of db2
we can implement sp on sysbase in java with this way.
stmt.execute(sqlstmt).
//execute next statement
"create procedure MMSP( @id " + "int" + ", @ordinal integer
)" + NEWLINE +
"as begin" + NEWLINE +
// List the clones of this field and remove this field
from the list
"exec MB_MDListClones @id" + NEWLINE +
// Propagate ordinal info for links
"update MB_MDDefinition set ordinal = @ordinal " +
"where fieldId in (select fieldId from " +
MB_CLONE_TEMP_TABLE_NAME + " where id
l**o
发帖数: 3
16
来自主题: Database版 - help on store procedure of db2
we can implement sp on sysbase in java with this way.
stmt.execute(sqlstmt).
//execute next statement
"create procedure MMSP( @id " + "int" + ", @ordinal integer
)" + NEWLINE +
"as begin" + NEWLINE +
// List the clones of this field and remove this field
from the list
"exec MB_MDListClones @id" + NEWLINE +
// Propagate ordinal info for links
"update MB_MDDefinition set ordinal = @ordinal " +
"where fieldId in (select fieldId from " +
MB_CLONE_TEMP_TABLE_NAME + " where id
c********0
发帖数: 262
17
随便写了一个shell的,
FILE_A=$1;
FILE_B=$2;
NEW_FILE=$3;
count=0;
while read line ; do
count=`expr $count + 1`;
newline=`head -n $count $FILE_B | tail -n 1`

#echo "$line $newline" >> $NEW_FILE
echo "$line $newline"
done < $FILE_A ;
b*******t
发帖数: 33714
18
来自主题: TeX版 - latex 表格自动排版的问题
\documentclass{article}
\usepackage{lipsum} % dummy random text
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}
}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m
{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}
m{#1}}
\begin{document}
\begin{tabular}{| c | c | c | L{4cm} | C{4cm} | R{4cm} |}
\hline
0& 1& 0& \lipsum[1]& \lipsum[1]& \lipsum[1]\\
\hline
\end{tabula... 阅读全帖
s****h
发帖数: 3979
19
来自主题: DataSciences版 - HIVE load CSV 问题请教
HIVE load CSV 问题请教
要load CSV files into HIVE,之前是用的下面(或者类似)的一个叫CSVSerde的jar
file
https://cwiki.apache.org/confluence/display/Hive/CSV+Serde
可是发现这个不能解决embedded newline的问题。如果某个cell里有newline,就会新
生成一行。
怎么办最好?
实在不行就只能用其他东西写个预处理,把newline 都替换成空格。
可是这样实在不方便.
g**********y
发帖数: 14569
20
来自主题: JobHunting版 - F的puzzle - Liar Liar
As a newbie on a particular internet discussion board, you notice a distinct
trend among its veteran members; everyone seems to be either unfailingly
honest or compulsively deceptive. You decide to try to identify the members
of the two groups, starting with the assumption that every senior member
either never lies or never tells the truth. You compile as much data as
possible, asking each person for a list of which people are liars. Since the
people you are asking have been around on the board ... 阅读全帖
k***t
发帖数: 276
21
自己顶一下,大拿们都不屑于写这个readLine()吗?
这道readLine()的题到底想考什么?
StackOverflow上的一个comment说要考security和memleak。
Implement a function
char* readLine();
which returns single lines from a buffer. To read the buffer, you can makes
use of a function
int read(char* buf, int len)
which fills buf with upto len chars and returns the actual number of chars
filled in. Function readLine can be called as many times as desired. If
there is no valid data or newline terminated string available, it must block
. In order to bloc... 阅读全帖
i*****a
发帖数: 153
22
来自主题: SanDiego版 - Summer Movie Calendar (转载)
【 以下文字转载自 Movie 讨论区 】
发信人: yituan (bob+dylan), 信区: Movie
标 题: Summer Movie Calendar
发信站: BBS 未名空间站 (Sat Apr 24 10:49:47 2010, 美东)
Summer终于来了
大片终于开战啦
基本列的是票房系电影
04.30
A Nightmare on Elm Street (Newline/Warner)
这周无疑是属于猛鬼街的
05.07
Iron Man 2 (Paramont)
钢铁侠出击
05.14
Robin Hood (Universal)
罗宾汉横扫
05.21
Shrek Forever After (Dreamworks/Paramont)
史莱克最后一部(号称)
05.27-05.28
Sex and The City 2 (HBO Films/Newline/Warner)
Prince of Persia (Disney)
这周将会是很有趣的一周
波斯王子撞车欲望都市
06.04
Get Him to the Greek (Universal)
Kil
y****n
发帖数: 3184
23
来自主题: Movie版 - Summer Movie Calendar
Summer终于来了
大片终于开战啦
基本列的是票房系电影
04.30
A Nightmare on Elm Street (Newline/Warner)
这周无疑是属于猛鬼街的
05.07
Iron Man 2 (Paramont)
钢铁侠出击
05.14
Robin Hood (Universal)
罗宾汉横扫
05.21
Shrek Forever After (Dreamworks/Paramont)
史莱克最后一部(号称)
05.27-05.28
Sex and The City 2 (HBO Films/Newline/Warner)
Prince of Persia (Disney)
这周将会是很有趣的一周
波斯王子撞车欲望都市
06.04
Get Him to the Greek (Universal)
Killers (Lionsgate)
Marmaduke (Fox)
这一周是非常冷场的一周,上述几个电影,Jonah Hill的喜剧片,Ashton Kutcher的喜
剧动作片,以及Owen Wilson的漫画改编狗片,似乎都没有办法对上周的两巨头构成威胁
。当
s******0
发帖数: 13782
24
来自主题: NJU版 - Summer Movie Calendar (转载)
【 以下文字转载自 Movie 讨论区 】
发信人: yituan (bob+dylan), 信区: Movie
标 题: Summer Movie Calendar
发信站: BBS 未名空间站 (Sat Apr 24 10:49:47 2010, 美东)
Summer终于来了
大片终于开战啦
基本列的是票房系电影
04.30
A Nightmare on Elm Street (Newline/Warner)
这周无疑是属于猛鬼街的
05.07
Iron Man 2 (Paramont)
钢铁侠出击
05.14
Robin Hood (Universal)
罗宾汉横扫
05.21
Shrek Forever After (Dreamworks/Paramont)
史莱克最后一部(号称)
05.27-05.28
Sex and The City 2 (HBO Films/Newline/Warner)
Prince of Persia (Disney)
这周将会是很有趣的一周
波斯王子撞车欲望都市
06.04
Get Him to the Greek (Universal)
Kil
s*****n
发帖数: 839
25
来自主题: CS版 - Python: index out of rang error
我的程序目的是把一个文件夹里面所有的csv file(4 columns each with same
variables)合并成一个文件。 总是得到IndexError: list index out of range
下面是我的程序:
import csv
import os
##this path is the location where raw data are stored
path = "C:/Users/Project/Python code/practice1/csv"
dirList=os.listdir(path)
##this fname is the output file name
fname = "C:/Users/Project/Python code/practice1/Combined file/combined.csv"
nfile = open(fname,'wb')
writer = csv.writer(nfile)
start = 0
for fn in dirList:
##this fullfn is the path for ... 阅读全帖
c**t
发帖数: 2744
26
来自主题: Database版 - ADO Bug Report
I use ADO 2.0 library in VB to get data from MSAccess, and find a bug:
if the recordset has a memo field in the middle, the rest fields will be
ignored. (There are newline in the memo field).
Does anybody else have the similar issue? If I put the memo field at the
end of select statement, the problem will go away. But if having two memo
fields, I don't have idea to retreive data. :-(
And how to update memo field with update statement? I can't think out a way
to escape newline, sigal quote, ..
b***i
发帖数: 3043
27
先说问题:主程序通知窗口显示"\n]",窗口得到字符串,要判断换行字符
String tobeappend="";
for(int i=0;i {
\ String temp=str.substring(i, i+1);
\ int tmp=(int)temp.toCharArray()[0];
\ if (temp=="\n")
\ newLine();
\ else
\ {
我跟踪到temp = "\n", 但是却执行了else部分。所以,我只好后来加上了 || tmp ==
10来判定回车,就可以了。不知道为什么有的时候\n]不能执行newLine();
现在的结果:在两位高手的帮助下,console终于做出来了,象当年的apple 了。
进入程序后,出现]_
等待用户输入指令。一共40行,80列。通过JTextArea(40, 80) 指定了窗口显示的区域
。当然,我指定了固定大小的字体Serif。
做法是,我在窗口类中设了缓冲区,40行。然后,指定setRows(43)。这样做是为了到
最后一行的
J*********r
发帖数: 5921
28
来自主题: Programming版 - 我也问个UDP网络编程中遇到的问题
client向server要求test文件并顺利收到,但是用diff命令对两文件进行比较的时候,
哪怕两个文件一样
diff也会给出图2的提示,我知道这个提示的含义,问题是我在源文件test最末已经加
了newline了(如图1)
有什么办法消除这个提示么?另外,有时候没这个提示(在源文件很小的时候偶尔没有
),但diff会
只提示"Binary files A and B differ",test是用"rb"和"wb"方式读和创建的,有没
有比较二进制文件的命令?
多谢。
//图1
"....................................
fclose(infile);
close(sockfd);
return 0;
}
"
//图2
me@me-laptop:~$ diff server/test client/test
10973a10974
>
\ No newline at end of file
mee@me-laptop:~$
t****t
发帖数: 6806
29
来自主题: Programming版 - 请帮忙看一下这个c程序(更新)
这个写得实在太混乱了, 我都没看明白你想要做什么. newline是一个重要的分隔符吗?
如果是, 那你想办法用fgets一次读入一行, 一行一行的处理. 如果不是, 那就用fread
一次读一个block, 或者写一个函数fgetc_skip_newline每次自动把newline跳过就好了
t****t
发帖数: 6806
30
来自主题: Programming版 - 问个缺少逗号的数组赋值问题
it's just c/c++ lexical convention
"a""b" means "ab"
strictly speaking, no literal newline can be included in a string literal (
except with \n), so for multiline string literal, such as
"a1\nb2\nc3\nd4\n"
it's more clear to write it as
"a1\n"
"b2\n"
"c3\n"
"d4\n"
of course you meant
"a1
b2
c3
d4
"
but newline is not allowed. c++0x introduced raw string literal which is a
little bit different.
i**a
发帖数: 13
31
如果定义了\newcommand{cmd}[args]{def}
那么在使用这个cmd的时候, 后面def里的newline全都被忽略掉了, 怎么才能force a
newline呢?
谢谢
s******0
发帖数: 13782
32
来自主题: ARKANSAS版 - Summer Movie Calendar (转载)
【 以下文字转载自 Movie 讨论区 】
发信人: yituan (bob+dylan), 信区: Movie
标 题: Summer Movie Calendar
发信站: BBS 未名空间站 (Sat Apr 24 10:49:47 2010, 美东)
Summer终于来了
大片终于开战啦
基本列的是票房系电影
04.30
A Nightmare on Elm Street (Newline/Warner)
这周无疑是属于猛鬼街的
05.07
Iron Man 2 (Paramont)
钢铁侠出击
05.14
Robin Hood (Universal)
罗宾汉横扫
05.21
Shrek Forever After (Dreamworks/Paramont)
史莱克最后一部(号称)
05.27-05.28
Sex and The City 2 (HBO Films/Newline/Warner)
Prince of Persia (Disney)
这周将会是很有趣的一周
波斯王子撞车欲望都市
06.04
Get Him to the Greek (Universal)
Kil
i*****8
发帖数: 6735
33
来自主题: _Xiyu版 - help with regular expression
你要不就写几行perl,里面设个flag。
或者run 这个:
perl -pi -w -e 's/$(\n)/ newline /g;' test.txt ; perl -pi -w -e 's///'
test.txt ; perl -pi -w -e 's/ newline /\n/g;' test.txt
这个会先把断行都换掉然后再换回来,肯定不是最优
g*******y
发帖数: 1930
34
加一个control bit,控制是否打印newline
原来的queue
现在变为queue>
z****n
发帖数: 1379
35
来自主题: JobHunting版 - 求教一道经典面题的解法
要是从底层开始打印,并且还要维持每层顺序的话,貌似只能处理queue的时候,把每一
行加入另外一个queue,遇到newline,就把这另外一个queue整体作为一个对象放到另一
个stack里。。。

,不
t******h
发帖数: 120
36
来自主题: JobHunting版 - 求教一道经典面题的解法
我一直用dummy node来做 但是昨天看到有人说有更简单的方法 请知道的赐教
我的做法 是一个队列 一个栈
循环开始前把root和dummy入队列
从队列里读结点
把这个点放到栈中 然后把他的子结点入队列
当读到dummy时 如果队列不为空 再把dummy入队列 压栈
如果队列为空 则表示从栈中输出结果 读到dummy时输出newline
a****d
发帖数: 114
37
awk -v RS="" '{print $0 "abc"}' note.txt
不管note.txt是不是以newline结尾都可以。
RS 是 record separator
c**z
发帖数: 669
38
来自主题: JobHunting版 - 问一道matching的算法题目,谢谢!!
这种matching题目应该使用什么算法,谢谢大家了!
we have to do now is implement a program
that assigns each product to a given customer while maximizing the total
suitability
of all products to all customers. so we need you to implement the matching
program.
The algorithm is:
• If the length of the product name is even, the base suitability
score (SS) is the
number of vowels in the customer’s name multiplied by 1.5.
• If the length of the product name is odd, the base SS is the number
of consonants
in th... 阅读全帖
m********l
发帖数: 4394
39
apparently your code didn't pass their test.
add "Thu Dec 11 17:53:01 PST 2008 [email protected] [email protected]"
to input and see what it does.
also, the output is rather rigid. maybe you didn't output a newline or a
tab correctly?

7:32 am
You
that
system
means
output, or
x*******7
发帖数: 223
40
来自主题: JobHunting版 - fb面试题【转】
不知道发过没,在其他地方看到的。
Implement a function
char* readLine();
which returns single lines from a buffer. To read the buffer, you can makes
use of a function
int read(char* buf, int len)
which fills buf with upto len chars and returns the actual number of chars
filled in. Function readLine can be called as many times as desired. If
there is no valid data or newline terminated string available, it must block
. In order to block, it can use read function which in turn will block when
it doesn't have anyth... 阅读全帖
k***t
发帖数: 276
41
谁写了?或有没有好一些的online的参考答案?
用于对照检查自己写的是否全面。谢谢。
发信人: xicheng17 (super), 信区: JobHunting
标 题: fb面试题【转】
发信站: BBS 未名空间站 (Wed Nov 9 20:42:44 2011, 美东)
不知道发过没,在其他地方看到的。
Implement a function
char* readLine();
which returns single lines from a buffer. To read the buffer, you can makes
use of a function
int read(char* buf, int len)
which fills buf with upto len chars and returns the actual number of chars
filled in. Function readLine can be called as many times as desired. If
there is no valid data or newl... 阅读全帖
c**********e
发帖数: 2007
42
来自主题: JobHunting版 - 有人在玩 Facebook 的黑客杯吗?
Can anybody look at this problem? The answer seems different from mine. 我觉
得答案不对。
Facebook Hacker Cup 2011 Round 1A
First or Last
As a top driver in European racing circles, you find yourself taking more
than your fair share of risks. You go into every race knowing it may be your
last, but generally with the suspicion it won't be. Today, however, may
turn out to be different. The Fédération Internationale de l'Automobile
has sanctioned a new track in the Bernese Alps that may prove to be death o... 阅读全帖
h*****g
发帖数: 312
43
来自主题: JobHunting版 - fb面试题【转】
Implement a function
char* readLine();
which returns single lines from a buffer. To read the buffer, you can makes
use of a function
int read(char* buf, int len)
which fills buf with upto len chars and returns the actual number of chars
filled in. Function readLine can be called as many times as desired. If
there is no valid data or newline terminated string available, it must block
. In order to block, it can use read function which in turn will block when
it doesn't have anything to fill the b... 阅读全帖
i**********e
发帖数: 1145
44
来自主题: JobHunting版 - 求字符串最后一个单词的长度
刚写了一个,没测过。
分隔符有哪些?
bool isSpace(char c) {
return c == ' ' || c == '\t'; // maybe newline considered as a space too?
}
int lengthOfLastWord(const char *s) {
if (!s) return 0;
int len = 0;
bool inWord = false;
while (*s) {
if (!inWord && !isSpace(*s)) {
inWord = true;
len = 0;
} else if (inWord && isSpace(*s)) {
inWord = false;
}
if (inWord) len++;
s++;
}
return len;
}
A**l
发帖数: 2650
45
来自主题: JobHunting版 - C的fscanf的问题 (转载)
A sequence of white-space characters (space, tab, newline, etc.; see isspace
(3)). This directive matches any amount of white space, including none, in
the input.
I have no idea what "[^\n]" exactly means... But you can use %s for sure.
s********u
发帖数: 1109
46
来自主题: JobHunting版 - ebay skype interview面经(4轮)
挖个坟,这个readline的题目,搜了一下,好像应该是这个意思吧:
用一个buffer来存字符流,如果中间有换行,那么将这一行返回成一个字符串输出,但
是这个buffer里面的东西继续保留,下次readline()再输出;
如果一行非常长,那么可能需要用到几次read(),来拼出这个完整的line。
/*Implement a function char* readLine(); which returns single lines from a
buffer.
To read the buffer, you can makes use of a function int read(char* buf, int
len) which fills buf with upto len chars and returns the actual number of
chars filled in. Function readLine can be called as many times as desired.
If there is no valid data or newline ter... 阅读全帖
M**A
发帖数: 78
47
来自主题: JobHunting版 - 请教github上1道编程题的题意
请教各位朋友, 下面github上1道编程题的题意。
Write a program in C/C++ that translates a pattern specification
provided as ancommand line argument into a regular expression, processes
lines of input text receivedfrom stdin using that regular expression to
qualify matches, and finally writes eachmatching input line to stdout.
Each line of input is terminated by the newline character'n', and the
program should terminate when it receives EOF.The program should be
executable as follows:$ cat input.txt | ... 阅读全帖
s*****b
发帖数: 8
48
来自主题: JobHunting版 - 请问除了刷题还能怎样提高编程
我来贴一个。
Rocket fule (Software Engineer - Machine Learning Scientist ) 技术电面后code
test. code通过了所有test cases. 人家看过code 后就拒了。问题在哪里呢?请各位
牛人不吝赐教。题目本版以前贴过
You are standing in a rectangular room and are about to fire a laser toward
the east wall. Inside the room a certain number of prisms have been placed.
They will alter the direction of the laser beam if it hits them. There
are north-facing, east-facing, west-facing, and south-facing prisms. If the
laser beam strikes an east-facing prism, its cours... 阅读全帖
a**d
发帖数: 85
49
来自主题: JobHunting版 - 请教一个fb面试问题
Implement a function char* readLine(); which returns single lines from a
buffer. To read the buffer, you can makes use of a function int read(char*
buf, int len) which fills buf with upto len chars and returns the actual
number of chars filled in. Function readLine can be called as many times as
desired. If there is no valid data or newline terminated string available,
it must block. In order to block, it can use read function which in turn
will block when it doesn't have anything to fill the bu... 阅读全帖
g********t
发帖数: 39
50
来自主题: JobHunting版 - 贡献Rocket Fuel 4 hour online test
贡献刚做的online test,职位是Machine Learning related。
Question 1 / 2 (LaserMaze)
You are standing in a rectangular room and are about to fire a laser toward
the east wall. Inside the room a certain number of prisms have been placed.
They will alter the direction of the laser beam if it hits them. There
are north-facing, east-facing, west-facing, and south-facing prisms. If the
laser beam strikes an east-facing prism, its course will be altered to be
East, regardless of what direction it had been goi... 阅读全帖
1 2 下页 末页 (共2页)