結果

問題 No.2153 何コーダーが何人?
ユーザー Maeda
提出日時 2025-04-14 15:54:58
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 1,177 bytes
コンパイル時間 8,476 ms
コンパイル使用メモリ 168,548 KB
実行使用メモリ 30,248 KB
最終ジャッジ日時 2025-04-14 15:55:10
合計ジャッジ時間 11,178 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (97 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            List<string> userName = new List<string>();
            List<int> userColor = new List<int>();
            for (int i = 0; i < n; i++)
            {
                string[] str = Console.ReadLine().Split(' ');
                if (userName.IndexOf(str[0]) != -1)
                {
                    userColor[userName.IndexOf(str[0])] = int.Parse(str[1]);
                }
                else
                {
                    userName.Add(str[0]);
                    userColor.Add(int.Parse(str[1]));
                }
            }
            int[] countColor = new int[8];
            countColor = UserColorCount(userColor, countColor);
            foreach(var count in countColor)
            {
                Console.WriteLine(count);
            }
        }

        private static int[] UserColorCount(List<int> userColor, int[] countColor)
        {
            for(int i = 0; i < userColor.Count; i++)
            {
                countColor[userColor[i]]++;
            }
            return countColor;
        }
    }
0