結果

問題 No.116 門松列(1)
ユーザー ixTL255ixTL255
提出日時 2016-09-10 00:36:21
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 63 ms / 5,000 ms
コード長 592 bytes
コンパイル時間 2,301 ms
コンパイル使用メモリ 104,064 KB
実行使用メモリ 23,620 KB
最終ジャッジ日時 2023-09-07 07:01:38
合計ジャッジ時間 5,046 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
23,540 KB
testcase_01 AC 62 ms
19,536 KB
testcase_02 AC 63 ms
21,504 KB
testcase_03 AC 62 ms
21,576 KB
testcase_04 AC 62 ms
19,472 KB
testcase_05 AC 63 ms
21,580 KB
testcase_06 AC 62 ms
23,528 KB
testcase_07 AC 63 ms
21,516 KB
testcase_08 AC 62 ms
21,508 KB
testcase_09 AC 62 ms
21,576 KB
testcase_10 AC 63 ms
19,480 KB
testcase_11 AC 62 ms
21,528 KB
testcase_12 AC 62 ms
21,620 KB
testcase_13 AC 63 ms
21,512 KB
testcase_14 AC 63 ms
21,552 KB
testcase_15 AC 61 ms
21,520 KB
testcase_16 AC 62 ms
19,552 KB
testcase_17 AC 63 ms
21,576 KB
testcase_18 AC 62 ms
21,576 KB
testcase_19 AC 61 ms
21,528 KB
testcase_20 AC 62 ms
23,620 KB
testcase_21 AC 61 ms
23,524 KB
testcase_22 AC 61 ms
21,568 KB
testcase_23 AC 61 ms
23,552 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;

public class Yuki116
{
	public static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var a = Console.ReadLine()
				.Split(' ')
				.Select(x => int.Parse(x))
				.ToList();
				
		int ans = 0;
		for(int i = 0; i < n - 2; i++)
		{
			ans += Check(a[i], a[i + 1], a[i + 2]);
		}
		
		Console.WriteLine(ans);
	}
	
	public static int Check(int x, int y , int z)
	{
		if(x == y|| x == z || y == z) return 0;
		if(Math.Max(x , Math.Max(y , z)) == y || 
			Math.Min(x , Math.Min(y , z)) == y) return 1;
		return 0;
	}
}
0