結果

問題 No.29 パワーアップ
ユーザー funakoshifunakoshi
提出日時 2019-06-20 17:38:51
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 58 ms / 5,000 ms
コード長 1,533 bytes
コンパイル時間 4,283 ms
コンパイル使用メモリ 101,648 KB
実行使用メモリ 22,768 KB
最終ジャッジ日時 2023-08-22 20:37:34
合計ジャッジ時間 5,817 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,776 KB
testcase_01 AC 57 ms
18,760 KB
testcase_02 AC 57 ms
22,664 KB
testcase_03 AC 57 ms
20,692 KB
testcase_04 AC 57 ms
20,784 KB
testcase_05 AC 58 ms
22,768 KB
testcase_06 AC 58 ms
20,636 KB
testcase_07 AC 58 ms
22,692 KB
testcase_08 AC 57 ms
20,628 KB
testcase_09 AC 57 ms
20,760 KB
testcase_10 AC 58 ms
20,564 KB
testcase_11 AC 58 ms
22,768 KB
testcase_12 AC 58 ms
22,680 KB
testcase_13 AC 58 ms
20,776 KB
testcase_14 AC 58 ms
20,624 KB
testcase_15 AC 58 ms
20,832 KB
testcase_16 AC 58 ms
20,648 KB
testcase_17 AC 57 ms
18,656 KB
testcase_18 AC 57 ms
18,716 KB
testcase_19 AC 58 ms
20,728 KB
testcase_20 AC 58 ms
22,612 KB
testcase_21 AC 58 ms
20,676 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace yukicoderTest
{
    class Program
    {
        static void Main(string[] args)
        {
            string n = Console.ReadLine();
            int[] itemcnt = new int[10];
            int defeattime = int.Parse(n);
            int pupcnt = 0;
            for(int i=0;i<itemcnt.Length;i++)
            {
                itemcnt[i] = 0;
            }
            for(int i=0;i<defeattime;i++)
            {
                string item = Console.ReadLine();
                string[] itemary = item.Split(' ');
                int a = int.Parse(itemary[0]);
                int b = int.Parse(itemary[1]);
                int c = int.Parse(itemary[2]);
                itemcnt[a - 1] = itemcnt[a - 1]+1;
                itemcnt[b - 1] = itemcnt[b - 1]+1;
                itemcnt[c - 1] = itemcnt[c - 1]+1;
                
            }
            int cnt = 0;
            for (int i=0;i<itemcnt.Length;i++)
            {
                while (itemcnt[i] >= 2)
                {
                    itemcnt[i] = itemcnt[i] - 2;
                    pupcnt++;
                }
                if (itemcnt[i] == 1)
                {
                    itemcnt[i]--;
                    cnt++;
                }
                if (cnt == 4)
                {
                    pupcnt++;
                    cnt = 0;
                }
            }

            Console.WriteLine(pupcnt);
        }
    }
}
0