結果
| 問題 |
No.116 門松列(1)
|
| コンテスト | |
| ユーザー |
mban
|
| 提出日時 | 2016-11-07 11:10:39 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 5,000 ms |
| コード長 | 731 bytes |
| コンパイル時間 | 3,178 ms |
| コンパイル使用メモリ | 106,496 KB |
| 実行使用メモリ | 19,200 KB |
| 最終ジャッジ日時 | 2024-06-25 01:24:45 |
| 合計ジャッジ時間 | 2,434 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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);
}
}
mban