結果
| 問題 | No.1564 Sum of Products of Pairs | 
| コンテスト | |
| ユーザー |  bluemegane | 
| 提出日時 | 2021-06-26 16:24:44 | 
| 言語 | C#(csc) (csc 3.9.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 147 ms / 2,000 ms | 
| コード長 | 483 bytes | 
| コンパイル時間 | 2,428 ms | 
| コンパイル使用メモリ | 103,680 KB | 
| 実行使用メモリ | 35,840 KB | 
| 最終ジャッジ日時 | 2024-06-25 10:54:52 | 
| 合計ジャッジ時間 | 4,687 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 30 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
public class Hello
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, long.Parse);
        getAns(n, a);
    }
    static void getAns(int n, long[] a)
    {
        n *= 2;
        var ans = 0L;
        Array.Sort(a);
        for (int i = 0; i < n; i += 2)
            ans += a[i] * a[i + 1];
        Console.WriteLine(ans);
    }
}
            
            
            
        