結果

問題 No.116 門松列(1)
ユーザー pirorirori_n712pirorirori_n712
提出日時 2018-07-20 02:27:27
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 61 ms / 5,000 ms
コード長 438 bytes
コンパイル時間 2,838 ms
コンパイル使用メモリ 107,704 KB
実行使用メモリ 23,780 KB
最終ジャッジ日時 2023-09-07 07:24:47
合計ジャッジ時間 5,402 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
21,660 KB
testcase_01 AC 61 ms
23,780 KB
testcase_02 AC 60 ms
21,580 KB
testcase_03 AC 61 ms
21,492 KB
testcase_04 AC 60 ms
21,528 KB
testcase_05 AC 60 ms
21,724 KB
testcase_06 AC 61 ms
23,716 KB
testcase_07 AC 61 ms
21,648 KB
testcase_08 AC 60 ms
19,456 KB
testcase_09 AC 61 ms
21,744 KB
testcase_10 AC 61 ms
23,672 KB
testcase_11 AC 61 ms
21,736 KB
testcase_12 AC 60 ms
23,632 KB
testcase_13 AC 60 ms
23,728 KB
testcase_14 AC 61 ms
21,836 KB
testcase_15 AC 61 ms
21,740 KB
testcase_16 AC 61 ms
23,760 KB
testcase_17 AC 60 ms
21,764 KB
testcase_18 AC 60 ms
23,552 KB
testcase_19 AC 60 ms
21,572 KB
testcase_20 AC 60 ms
21,600 KB
testcase_21 AC 59 ms
21,696 KB
testcase_22 AC 60 ms
23,720 KB
testcase_23 AC 60 ms
21,684 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.Linq;

class No116{
    static void Main(){
        var a=Int32.Parse(Console.ReadLine())-1;
        var b=Console.ReadLine().Split(' ').Select(x=>Int32.Parse(x)).ToArray();
        var c=0;
        for(int i=1;i<a;++i){
            if(b[i-1]==b[i+1])continue;
            if(b[i]-b[i-1]>0&&b[i]-b[i+1]>0)c++;
            else if(b[i]-b[i-1]<0&&b[i]-b[i+1]<0)c++;
        }
        Console.WriteLine(c);
    }
}
0