結果

問題 No.116 門松列(1)
ユーザー Maeda
提出日時 2025-04-11 10:04:09
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 60 ms / 5,000 ms
コード長 1,019 bytes
コンパイル時間 10,363 ms
コンパイル使用メモリ 172,528 KB
実行使用メモリ 187,252 KB
最終ジャッジ日時 2025-04-11 10:04:25
合計ジャッジ時間 14,259 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (107 ミリ秒)。
  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());
            int[] candidate = Array.ConvertAll(Console.ReadLine().Split(' '), num => int.Parse(num));
            int count = 0;
            for(int i = 0; i < n - 2; i++)
            {
                int[]judge = new int[3];
                Array.Copy(candidate, i, judge, 0, 3);
                if (JudgeKadomatsu(judge))
                {
                    count++;
                }
            }
            Console.WriteLine(count);
        }

        private static bool JudgeKadomatsu(int[] judge)
        {
            bool clearFlg = true;
            if (judge[0] == judge[1] || judge[0] == judge[2] || judge[1] == judge[2])
            {
                clearFlg = false;
            }
            if (clearFlg && !(judge.Max() == judge[1] || judge.Min() == judge[1]))
            {
                clearFlg = false ;
            }
            return clearFlg;
        }
    }   
0