結果

問題 No.29 パワーアップ
ユーザー abL8ZLsTbFabL8ZLsTbF
提出日時 2016-04-22 16:01:19
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 27 ms / 5,000 ms
コード長 701 bytes
コンパイル時間 1,053 ms
コンパイル使用メモリ 108,932 KB
実行使用メモリ 26,248 KB
最終ジャッジ日時 2024-04-15 04:12:55
合計ジャッジ時間 2,437 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
21,808 KB
testcase_01 AC 25 ms
23,952 KB
testcase_02 AC 26 ms
23,860 KB
testcase_03 AC 26 ms
24,112 KB
testcase_04 AC 26 ms
23,816 KB
testcase_05 AC 26 ms
25,900 KB
testcase_06 AC 26 ms
26,020 KB
testcase_07 AC 26 ms
25,896 KB
testcase_08 AC 26 ms
22,068 KB
testcase_09 AC 26 ms
24,100 KB
testcase_10 AC 25 ms
21,944 KB
testcase_11 AC 26 ms
26,020 KB
testcase_12 AC 26 ms
24,080 KB
testcase_13 AC 26 ms
23,828 KB
testcase_14 AC 25 ms
23,696 KB
testcase_15 AC 26 ms
26,020 KB
testcase_16 AC 26 ms
24,112 KB
testcase_17 AC 26 ms
24,104 KB
testcase_18 AC 26 ms
23,952 KB
testcase_19 AC 26 ms
23,824 KB
testcase_20 AC 27 ms
26,248 KB
testcase_21 AC 26 ms
23,980 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Program {
    public static void Main() {
        int n = int.Parse(Console.ReadLine());
        int[] item = new int[10];
        for (int i = 0; i < 10; i++) item[i] = 0;
        for (int i = 0; i < n; i++) {
            int[] arr = Array.ConvertAll(Console.ReadLine().Split(), value => int.Parse(value)-1);
            foreach (int temp in arr) item[temp]++;
        }
        int ans = 0;
        int rest = 0;
        for (int i = 0; i < 10; i++) {
            ans += (item[i] / 2);
            rest += item[i] % 2;
            if (rest >= 4) {
                ans += rest / 4;
                rest %= 4;
            }
        }
        Console.WriteLine(ans);
    }
}
0