結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
36,864 KB
testcase_01 AC 57 ms
38,400 KB
testcase_02 AC 60 ms
38,528 KB
testcase_03 AC 63 ms
38,400 KB
testcase_04 AC 55 ms
38,656 KB
testcase_05 AC 54 ms
38,400 KB
testcase_06 AC 54 ms
38,400 KB
testcase_07 AC 56 ms
38,528 KB
testcase_08 AC 56 ms
38,656 KB
testcase_09 AC 57 ms
38,528 KB
testcase_10 AC 56 ms
38,656 KB
testcase_11 AC 54 ms
38,400 KB
testcase_12 AC 54 ms
38,656 KB
testcase_13 AC 56 ms
38,400 KB
testcase_14 AC 54 ms
38,400 KB
testcase_15 AC 47 ms
36,992 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