結果

問題 No.342 一番ワロタww
ユーザー butchi_ybutchi_y
提出日時 2015-05-10 15:20:52
言語 JavaScript
(node v21.7.1)
結果
WA  
実行時間 -
コード長 811 bytes
コンパイル時間 29 ms
コンパイル使用メモリ 5,120 KB
実行使用メモリ 38,656 KB
最終ジャッジ日時 2024-04-21 01:13:15
合計ジャッジ時間 1,709 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
36,864 KB
testcase_01 AC 57 ms
38,272 KB
testcase_02 AC 59 ms
38,400 KB
testcase_03 AC 59 ms
38,400 KB
testcase_04 AC 59 ms
38,272 KB
testcase_05 AC 57 ms
38,656 KB
testcase_06 AC 56 ms
38,272 KB
testcase_07 AC 57 ms
38,400 KB
testcase_08 AC 54 ms
38,656 KB
testcase_09 AC 54 ms
38,400 KB
testcase_10 AC 59 ms
38,272 KB
testcase_11 AC 58 ms
38,400 KB
testcase_12 AC 60 ms
38,400 KB
testcase_13 AC 58 ms
38,656 KB
testcase_14 WA -
testcase_15 AC 49 ms
36,736 KB
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

function Main(input) {
  var arr, ret, i, len;

  arr = input.split(wrep(wlen(input)));

  len = (arr || []).length
  for(i = 0; i < len - 1; i++) {
    if(arr[i] !== '') {
      var tmpArr = arr[i].split('w')
      var line = last(tmpArr);
      console.log(line);
    }
  }
}

// "w"のlength回の繰り返し
function wrep(length) {
  return (new Array(length + 1)).join('w')
}

// 文字列の中で"w"が一番長く連続する回数
function wlen(str) {
  var arr, ret, i, len;

  arr = str.match(/w+/g);
  len = (arr || []).length;
  ret = 0;
  for(i = 0; i < len; i++) {
    if(arr[i].length > ret) {
      ret = arr[i].length;
    }
  }

  return ret;
}

function last(arr) {
  return arr[arr.length - 1];
}

// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0