how to use octave on hackerrank website?

5 ビュー (過去 30 日間)
Weiqian Jiang
Weiqian Jiang 2020 年 4 月 17 日
コメント済み: Weiqian Jiang 2020 年 4 月 20 日
hi there,
now I am trying to use octave to do the hackerrank test, but everytime I click on the 'Run code' button, it always says that 'no response on stdout', here is the code and note:
# Enter your code here. Read input from STDIN. Print output to STDOUT
a = stdin;
pivot = a(1);
equal = pivot;
left = a(a<pivot);
right = a(a>pivot);
stdout = [left equal right];
Does anyone knows this? Many thanks!
  7 件のコメント
Geoff Hayes
Geoff Hayes 2020 年 4 月 19 日
Weiqian - if you need exactly one space between each character then perhaps try something like
printf('%d', b(1));
for k = 2:length(b)
printf(' %d')
end
instead of disp.
Weiqian Jiang
Weiqian Jiang 2020 年 4 月 20 日
hi Geoff, thanks for your reply, I used 'fprintf('%d ',b);' and it works,thanks.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeOctave についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by