結果

問題 No.143 豆
ユーザー yu0912
提出日時 2020-07-23 13:22:50
言語 JavaScript
(node v23.5.0)
結果
WA  
実行時間 -
コード長 548 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 7,076 KB
実行使用メモリ 39,424 KB
最終ジャッジ日時 2024-06-23 17:31:54
合計ジャッジ時間 1,981 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 3
権限があれば一括ダウンロードができます

ソースコード

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