結果

問題 No.723 2つの数の和
ユーザー yun8686
提出日時 2019-11-20 11:38:25
言語 JavaScript
(node v23.5.0)
結果
AC  
実行時間 202 ms / 2,000 ms
コード長 492 bytes
コンパイル時間 33 ms
コンパイル使用メモリ 6,692 KB
実行使用メモリ 57,872 KB
最終ジャッジ日時 2024-10-13 01:28:49
合計ジャッジ時間 3,963 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

process.stdin.resume();
process.stdin.setEncoding('utf8');
// Your code here!

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));
function main(inputs){
    var N = inputs[0].split(" ")[0]-0;
    var X = inputs[0].split(" ")[1]-0;
    var list = inputs[1].split(" ").map(v=>v-0);
    var map = {};
    list.forEach(v=>{
        map[v] = (map[v]||0)+1;
    });
    
    var ans = 0;
    list.forEach(v=>{
        ans += map[X-v]||0;
    });
    
    console.log(ans);
}
0