結果

問題 No.2109 Special Week
ユーザー Maeda
提出日時 2025-04-15 09:13:40
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 1,353 bytes
コンパイル時間 7,970 ms
コンパイル使用メモリ 170,072 KB
実行使用メモリ 189,920 KB
最終ジャッジ日時 2025-04-15 09:13:53
合計ジャッジ時間 10,990 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (111 ミリ秒)。
  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[] dayList = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
            int[] numList = new int[10];
            int[] n = Array.ConvertAll(Console.ReadLine().Split(' '), num => int.Parse(num.ToString()));
            DateTime checkDate = new DateTime(1, n[0], n[1]);
            for(int i = 0; i < 7; i++)
            {
                string dayStr = checkDate.ToString().Substring(5, 5);
                for(int j = 0; j < 5; j++)
                {
                    if (dayStr[j] == '/')
                    {
                        continue;
                    }
                    numList[int.Parse(dayStr[j].ToString())]++;
                }
                checkDate = checkDate.AddDays(1);
            }
            int count = PopNumber(numList);
            if(count >= n[2])
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }

        private static int PopNumber(int[] numList)
        {
            int count = 0;
            for(int i = 0; i < 10; i++)
            {
                if (numList[i] != 0)
                {
                    count++;
                }
            }
            return count;
        }
    }
0