結果

問題 No.1470 Mex Sum
ユーザー bluemeganebluemegane
提出日時 2021-04-10 07:40:31
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 765 bytes
コンパイル時間 1,677 ms
コンパイル使用メモリ 63,440 KB
実行使用メモリ 39,648 KB
最終ジャッジ日時 2023-09-08 03:37:27
合計ジャッジ時間 10,777 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
18,712 KB
testcase_01 AC 57 ms
22,716 KB
testcase_02 AC 69 ms
21,572 KB
testcase_03 AC 69 ms
21,548 KB
testcase_04 AC 68 ms
21,560 KB
testcase_05 AC 68 ms
21,676 KB
testcase_06 AC 69 ms
21,608 KB
testcase_07 AC 70 ms
21,552 KB
testcase_08 AC 69 ms
21,552 KB
testcase_09 AC 70 ms
23,564 KB
testcase_10 AC 70 ms
23,640 KB
testcase_11 AC 70 ms
21,668 KB
testcase_12 AC 121 ms
37,540 KB
testcase_13 AC 121 ms
37,384 KB
testcase_14 AC 121 ms
35,380 KB
testcase_15 AC 121 ms
37,456 KB
testcase_16 AC 121 ms
35,456 KB
testcase_17 AC 123 ms
37,304 KB
testcase_18 AC 121 ms
37,336 KB
testcase_19 AC 118 ms
37,324 KB
testcase_20 AC 121 ms
37,408 KB
testcase_21 AC 125 ms
37,496 KB
testcase_22 AC 124 ms
35,636 KB
testcase_23 AC 122 ms
35,548 KB
testcase_24 AC 123 ms
33,464 KB
testcase_25 AC 124 ms
37,584 KB
testcase_26 AC 123 ms
35,520 KB
testcase_27 AC 120 ms
35,528 KB
testcase_28 AC 122 ms
37,636 KB
testcase_29 AC 125 ms
35,552 KB
testcase_30 AC 125 ms
35,740 KB
testcase_31 AC 123 ms
35,616 KB
testcase_32 AC 123 ms
33,500 KB
testcase_33 AC 123 ms
35,548 KB
testcase_34 AC 122 ms
37,696 KB
testcase_35 AC 122 ms
39,648 KB
testcase_36 AC 123 ms
33,592 KB
testcase_37 AC 118 ms
36,340 KB
testcase_38 AC 116 ms
36,340 KB
testcase_39 AC 117 ms
34,300 KB
testcase_40 AC 116 ms
36,536 KB
testcase_41 AC 114 ms
36,364 KB
testcase_42 AC 117 ms
36,324 KB
testcase_43 AC 116 ms
36,368 KB
testcase_44 AC 117 ms
34,296 KB
testcase_45 AC 116 ms
34,312 KB
testcase_46 AC 116 ms
36,416 KB
testcase_47 AC 118 ms
36,364 KB
testcase_48 AC 119 ms
36,336 KB
testcase_49 AC 118 ms
34,336 KB
testcase_50 AC 117 ms
34,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;

public class Hello
{
    public static long c1, c2, c3;
    static void Main()
    {

        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        c1 = c2 = c3 = 0;
        for (int i = 0; i < n; i++)
        {
            if (a[i] == 1) c1++;
            else if (a[i] == 2) c2++;
            else c3++;
        }
        getAns();
    }
    static void getAns()
    {
        var a11 = c1 * (c1 - 1);
        var a22 = c2 * (c2 - 1) / 2;
        var a33 = c3 * (c3 - 1) / 2;
        var a12 = c1 * c2 * 3;
        var a13 = c1 * c3 * 2;
        var a23 = c2 * c3;
        Console.WriteLine(a11 + a22 + a33 + a12 + a13 + a23);
    }
}
0