結果
問題 | No.342 一番ワロタww |
ユーザー | yun_app |
提出日時 | 2016-05-11 13:04:25 |
言語 | JavaScript (node v21.7.1) |
結果 |
AC
|
実行時間 | 88 ms / 5,000 ms |
コード長 | 1,054 bytes |
コンパイル時間 | 64 ms |
コンパイル使用メモリ | 5,456 KB |
実行使用メモリ | 44,348 KB |
最終ジャッジ日時 | 2023-08-03 01:37:06 |
合計ジャッジ時間 | 2,349 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 82 ms
44,320 KB |
testcase_01 | AC | 88 ms
42,360 KB |
testcase_02 | AC | 82 ms
42,388 KB |
testcase_03 | AC | 81 ms
44,348 KB |
testcase_04 | AC | 80 ms
42,276 KB |
testcase_05 | AC | 80 ms
42,308 KB |
testcase_06 | AC | 82 ms
42,280 KB |
testcase_07 | AC | 80 ms
42,336 KB |
testcase_08 | AC | 81 ms
42,308 KB |
testcase_09 | AC | 81 ms
42,400 KB |
testcase_10 | AC | 80 ms
42,312 KB |
testcase_11 | AC | 80 ms
42,304 KB |
testcase_12 | AC | 79 ms
42,276 KB |
testcase_13 | AC | 81 ms
42,312 KB |
testcase_14 | AC | 80 ms
42,380 KB |
testcase_15 | AC | 80 ms
42,276 KB |
testcase_16 | AC | 80 ms
42,308 KB |
ソースコード
process.stdin.resume(); process.stdin.setEncoding('utf8'); process.stdin.on('data', function(chunk) { main(chunk.trim()); }); function main(chunk){ // your code goes here var words = []; var pool = ""; var w_cnt = 0; var max_length = 0; for(var i in chunk){ if(chunk[i]=='w'){ w_cnt++; if(pool!="") words.push({word:pool}); pool = ""; }else{ if(w_cnt > 0 && words[words.length-1]){ words[words.length-1].length = w_cnt; max_length = Math.max(max_length,w_cnt); } pool += chunk[i]; w_cnt = 0; } } if(w_cnt > 0 && words[words.length-1]) words[words.length-1].length = w_cnt; max_length = Math.max(max_length,w_cnt); pool += chunk[i]; if(max_length==0){ console.log(""); }else{ for(var i in words){ if(words[i].length == max_length){ console.log(words[i].word); } } } }