結果

問題 No.1564 Sum of Products of Pairs
ユーザー irumo8202
提出日時 2022-02-17 22:38:21
言語 TypeScript
(5.7.2)
結果
WA  
実行時間 -
コード長 488 bytes
コンパイル時間 8,583 ms
コンパイル使用メモリ 227,808 KB
実行使用メモリ 64,120 KB
最終ジャッジ日時 2024-12-31 16:46:19
合計ジャッジ時間 16,998 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import * as fs from "fs"

const main = (args: string): void => {
    const input = args.trim().split("\n");
    const N = parseInt(input.shift())
    const A = input.shift().split(" ").map(x => Number(x))
    A.sort()
    let ans = BigInt(0)

    for (let i = 0; i < 2 * N; i += 2) {
        ans += BigInt(A[i] * A[i + 1])
    }
    console.log(String(ans))
}

main(fs.readFileSync('/dev/stdin', 'utf8'));

function apply<T, R>(value: T, func: (arg: T) => R): R {
    return func(value)
}
0