結果

問題 No.188 HAPPY DAY
ユーザー funakoshifunakoshi
提出日時 2019-06-26 15:15:55
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 53 ms / 1,000 ms
コード長 2,046 bytes
コンパイル時間 2,172 ms
コンパイル使用メモリ 102,732 KB
実行使用メモリ 20,392 KB
最終ジャッジ日時 2023-09-07 06:18:13
合計ジャッジ時間 2,980 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
20,392 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)
        {
            int[] month = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
            string[] day = { "01", "02", "03", "04", "05", "06", "07", "08","09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" };
            int cnt = 0;
            for (int i=0;i<month.Length;i++)
            {
                if (i == 0 || i == 2 || i == 4 || i == 6 || i == 7 || i == 9 || i == 11)
                {
                    for(int j=0;j<31;j++)
                    {
                        int day1 = int.Parse(day[j].Substring(0, 1));
                        int day2 = int.Parse(day[j].Substring(1, 1));
                        if(month[i]==day1+day2)
                        {
                            cnt++;
                        }
                    }
                }
                else if(i == 3 || i == 5 || i == 8 || i == 10 )
                {
                    for (int j = 0; j < 30; j++)
                    {
                        int day1 = int.Parse(day[j].Substring(0, 1));
                        int day2 = int.Parse(day[j].Substring(1, 1));
                        if (month[i] == day1 + day2)
                        {
                            cnt++;
                        }
                    }
                }
                else
                {
                    for (int j = 0; j < 28; j++)
                    {
                        int day1 = int.Parse(day[j].Substring(0, 1));
                        int day2 = int.Parse(day[j].Substring(1, 1));
                        if (month[i] == day1 + day2)
                        {
                            cnt++;
                        }
                    }
                }

            }
            Console.WriteLine(cnt);

        }

    }
}
0