結果

問題 No.116 門松列(1)
ユーザー YukimotoPGYukimotoPG
提出日時 2019-02-14 13:57:05
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 450 bytes
コンパイル時間 2,011 ms
コンパイル使用メモリ 71,996 KB
実行使用メモリ 56,548 KB
最終ジャッジ日時 2023-10-11 12:35:40
合計ジャッジ時間 6,306 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 119 ms
55,564 KB
testcase_05 AC 122 ms
56,132 KB
testcase_06 AC 119 ms
55,596 KB
testcase_07 AC 122 ms
55,876 KB
testcase_08 AC 124 ms
54,128 KB
testcase_09 AC 120 ms
56,160 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 130 ms
56,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		int n = sc.nextInt();
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = sc.nextInt();
		int ans = 0;
		for (int i=0; i<n-2; i++) {
			if (ar[0]!=ar[1] && ar[1]!=ar[2] && ar[0]!=ar[2]) {
				if ((ar[0]<ar[1]&&ar[1]>ar[2]) || (ar[0]>ar[1]&&ar[1]<ar[2])) {
					ans++;
				}
			}
		}
		System.out.println(ans);
		
	}
}
0