結果

問題 No.143 豆
ユーザー jesuissuyaa
提出日時 2019-11-06 07:10:48
言語 JavaScript
(node v23.5.0)
結果
AC  
実行時間 66 ms / 1,000 ms
コード長 593 bytes
コンパイル時間 122 ms
コンパイル使用メモリ 6,940 KB
実行使用メモリ 41,332 KB
最終ジャッジ日時 2024-07-23 11:21:49
合計ジャッジ時間 1,981 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

function Main(input) {
    // inputにはすべての入力の文字列が与えられるので必要に応じて input.split("\n") などで分割する。

    var data = input.split("\n")
    
    const [k, n, f] = data[0].split(' ').map(item => parseInt(item))
    const num_beans = k * n
    const ages = data[1].split(' ').map(item => parseInt(item))
    const sum_ages = ages.reduce((acc, crr) => acc + crr)
    const res = num_beans - sum_ages < 0 ? -1 : num_beans - sum_ages
    console.log(res)
    
}

// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0