結果

問題 No.116 門松列(1)
ユーザー mbanmban
提出日時 2016-11-07 11:10:39
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 64 ms / 5,000 ms
コード長 731 bytes
コンパイル時間 2,524 ms
コンパイル使用メモリ 106,128 KB
実行使用メモリ 23,744 KB
最終ジャッジ日時 2023-09-07 07:05:38
合計ジャッジ時間 5,446 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
19,628 KB
testcase_01 AC 62 ms
21,644 KB
testcase_02 AC 62 ms
19,764 KB
testcase_03 AC 63 ms
23,584 KB
testcase_04 AC 62 ms
19,604 KB
testcase_05 AC 62 ms
21,600 KB
testcase_06 AC 62 ms
23,712 KB
testcase_07 AC 62 ms
23,696 KB
testcase_08 AC 63 ms
23,744 KB
testcase_09 AC 64 ms
21,700 KB
testcase_10 AC 63 ms
23,696 KB
testcase_11 AC 62 ms
21,656 KB
testcase_12 AC 62 ms
19,760 KB
testcase_13 AC 63 ms
21,812 KB
testcase_14 AC 63 ms
23,716 KB
testcase_15 AC 62 ms
21,648 KB
testcase_16 AC 62 ms
23,600 KB
testcase_17 AC 61 ms
21,744 KB
testcase_18 AC 63 ms
23,584 KB
testcase_19 AC 62 ms
23,724 KB
testcase_20 AC 63 ms
21,648 KB
testcase_21 AC 63 ms
21,780 KB
testcase_22 AC 62 ms
19,720 KB
testcase_23 AC 61 ms
21,680 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;

class Magatro
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        int cnt = 0;
        int[]A = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        for(int i = 1; i < N-1; i++)
        {
            if (A[i - 1] != A[i] && A[i - 1] != A[i + 1] && A[i] != A[i + 1])
            {
                int[] arr = new int[3];
                arr[0] = A[i - 1];
                arr[1] = A[i];
                arr[2] = A[i + 1];
                if (arr[1] == arr.Max()||arr[1]==arr.Min())
                {
                    cnt++;
                }
            }
        }
        Console.WriteLine(cnt);
    }
}
0