Guest User

test

a guest
Dec 5th, 2014
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. process.stdin.resume();
  2. process.stdin.setEncoding('utf8');
  3. // 自分の得意な言語で
  4. // Let's チャレンジ!!
  5.  
  6. var chunks = ""
  7. process.stdin.on('data', function (chunk) {
  8.     chunks += chunk.toString();
  9. });
  10. process.stdin.on('end', function () {
  11.     var line = chunks.split(/\r?\n/g);
  12.     var all = 0, temp, i, max = 0;
  13.     temp = line[0].split(/\s/);
  14.     line = line.slice(1, 1 + temp[1]);
  15.     for (i = 0; i < line.length; i++) {
  16.         all = all + (+line[i]) - ((+line[i - temp[0]]) || 0)
  17.         max = max > all ? max : all;
  18.     }
  19.     console.log(max);
  20. });
Advertisement
Add Comment
Please, Sign In to add comment