結果

問題 No.116 門松列(1)
ユーザー TDTD
提出日時 2022-06-06 15:23:50
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 28 ms / 5,000 ms
コード長 1,087 bytes
コンパイル時間 2,440 ms
コンパイル使用メモリ 106,400 KB
実行使用メモリ 24,144 KB
最終ジャッジ日時 2023-10-21 03:36:11
合計ジャッジ時間 4,167 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
24,144 KB
testcase_01 AC 27 ms
24,144 KB
testcase_02 AC 27 ms
24,144 KB
testcase_03 AC 27 ms
24,144 KB
testcase_04 AC 27 ms
24,144 KB
testcase_05 AC 27 ms
24,144 KB
testcase_06 AC 27 ms
24,144 KB
testcase_07 AC 28 ms
24,144 KB
testcase_08 AC 27 ms
24,144 KB
testcase_09 AC 27 ms
24,144 KB
testcase_10 AC 27 ms
24,144 KB
testcase_11 AC 27 ms
24,144 KB
testcase_12 AC 27 ms
24,144 KB
testcase_13 AC 27 ms
24,144 KB
testcase_14 AC 27 ms
24,144 KB
testcase_15 AC 27 ms
24,144 KB
testcase_16 AC 27 ms
24,144 KB
testcase_17 AC 27 ms
24,144 KB
testcase_18 AC 27 ms
24,144 KB
testcase_19 AC 27 ms
24,144 KB
testcase_20 AC 27 ms
24,144 KB
testcase_21 AC 27 ms
24,144 KB
testcase_22 AC 27 ms
24,144 KB
testcase_23 AC 28 ms
24,144 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split(' ');
            int[] b = new int[3];
            int[] c = new int[3];
            int k;
            int count = 0;

            for(int i = 0; i <= a; i++)
            {
                if (i + 2 >= a)
                {
                    break;
                }
                b[0] = int.Parse(s[i]);
                b[1] = int.Parse(s[i + 1]);
                b[2] = int.Parse(s[i+2]);
                for(int j = 0; j < 3; j++)
                {
                    c[j]=b[j];
                }
               Array.Sort(c);
                k=c[1];
                if (k == b[0] || k == b[2])
                {
                    if (b[0]!=b[1]&&b[0]!=b[2]&&b[1]!=b[2])
                    {
                        count++;
                    }
                }
                
            }
            Console.WriteLine(count);
           
        }
    }
}
0