結果

問題 No.116 門松列(1)
ユーザー keymoonkeymoon
提出日時 2019-02-23 16:31:51
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 62 ms / 5,000 ms
コード長 688 bytes
コンパイル時間 2,497 ms
コンパイル使用メモリ 102,900 KB
実行使用メモリ 23,720 KB
最終ジャッジ日時 2023-09-07 07:29:09
合計ジャッジ時間 5,082 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
23,432 KB
testcase_01 AC 60 ms
21,448 KB
testcase_02 AC 61 ms
21,676 KB
testcase_03 AC 61 ms
23,500 KB
testcase_04 AC 61 ms
23,500 KB
testcase_05 AC 61 ms
21,460 KB
testcase_06 AC 60 ms
21,628 KB
testcase_07 AC 61 ms
21,500 KB
testcase_08 AC 61 ms
21,556 KB
testcase_09 AC 61 ms
21,656 KB
testcase_10 AC 62 ms
23,720 KB
testcase_11 AC 62 ms
21,604 KB
testcase_12 AC 61 ms
21,612 KB
testcase_13 AC 61 ms
23,508 KB
testcase_14 AC 61 ms
21,388 KB
testcase_15 AC 61 ms
23,616 KB
testcase_16 AC 61 ms
21,400 KB
testcase_17 AC 61 ms
23,620 KB
testcase_18 AC 61 ms
23,604 KB
testcase_19 AC 61 ms
21,772 KB
testcase_20 AC 61 ms
23,496 KB
testcase_21 AC 60 ms
21,600 KB
testcase_22 AC 61 ms
21,672 KB
testcase_23 AC 60 ms
21,660 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.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split().Select(int.Parse).ToList();
        int res = 0;
        for (int i = 0; i < a.Count - 2; i++)
        {
            if (a[i] != a[i + 2] && ((a[i] < a[i + 1] && a[i + 1] > a[i + 2]) || (a[i] > a[i + 1] && a[i + 1] < a[i + 2]))) res++;
        }
        Console.WriteLine(res);
    }
}
0