結果

問題 No.342 一番ワロタww
ユーザー butchi_ybutchi_y
提出日時 2015-05-10 15:29:14
言語 JavaScript
(node v21.7.1)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 890 bytes
コンパイル時間 59 ms
コンパイル使用メモリ 5,460 KB
実行使用メモリ 44,356 KB
最終ジャッジ日時 2023-08-03 01:27:06
合計ジャッジ時間 2,229 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
42,052 KB
testcase_01 AC 77 ms
42,180 KB
testcase_02 AC 76 ms
42,184 KB
testcase_03 AC 75 ms
42,184 KB
testcase_04 AC 75 ms
42,232 KB
testcase_05 AC 74 ms
42,156 KB
testcase_06 AC 79 ms
42,232 KB
testcase_07 AC 75 ms
42,228 KB
testcase_08 AC 76 ms
42,236 KB
testcase_09 AC 76 ms
44,356 KB
testcase_10 AC 76 ms
42,276 KB
testcase_11 AC 77 ms
42,204 KB
testcase_12 AC 75 ms
42,280 KB
testcase_13 AC 75 ms
42,196 KB
testcase_14 AC 76 ms
42,160 KB
testcase_15 AC 70 ms
42,212 KB
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

  wlen = wLength(input);
  if(wlen === 0) {
    console.log('');
    return;
  }

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

  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 wLength(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