結果

問題 No.143 豆
ユーザー yu0912yu0912
提出日時 2020-07-23 13:22:50
言語 JavaScript
(node v21.7.1)
結果
WA  
実行時間 -
コード長 548 bytes
コンパイル時間 49 ms
コンパイル使用メモリ 5,216 KB
実行使用メモリ 42,356 KB
最終ジャッジ日時 2023-09-05 22:11:29
合計ジャッジ時間 2,519 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
42,136 KB
testcase_01 AC 77 ms
42,048 KB
testcase_02 AC 75 ms
42,052 KB
testcase_03 AC 75 ms
42,044 KB
testcase_04 AC 77 ms
42,156 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 76 ms
42,292 KB
testcase_09 AC 76 ms
42,080 KB
testcase_10 AC 76 ms
42,232 KB
testcase_11 AC 76 ms
42,052 KB
testcase_12 AC 75 ms
42,092 KB
testcase_13 AC 75 ms
42,228 KB
testcase_14 AC 75 ms
42,056 KB
testcase_15 AC 74 ms
42,148 KB
testcase_16 AC 77 ms
42,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

function main(input = ``) {
  let lines = input.split('\n');

  let [numBeansPerPack, numPacks, numPeople] = lines[0]
    .split(' ')
    .map((val) => parseInt(val));

  let ages = lines[1].split(' ').map((val) => parseInt(val));

  return `${ages.reduce((numBeans, age) => {
    return numBeans - age;
  }, numBeansPerPack * numPacks)}`;
}

const { readFileSync, existsSync } = require('fs');
const stdin = '/dev/stdin';

if (existsSync(stdin)) {
  const input = readFileSync(stdin, 'utf8');
  console.log(main(input));
}

module.exports = main;
0