Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- process.stdin.resume();
- process.stdin.setEncoding('utf8');
- // 自分の得意な言語で
- // Let's チャレンジ!!
- var chunks = ""
- process.stdin.on('data', function (chunk) {
- chunks += chunk.toString();
- });
- process.stdin.on('end', function () {
- var line = chunks.split(/\r?\n/g);
- var all = 0, temp, i, max = 0;
- temp = line[0].split(/\s/);
- line = line.slice(1, 1 + temp[1]);
- for (i = 0; i < line.length; i++) {
- all = all + (+line[i]) - ((+line[i - temp[0]]) || 0)
- max = max > all ? max : all;
- }
- console.log(max);
- });
Advertisement
Add Comment
Please, Sign In to add comment