結果
問題 | No.116 門松列(1) |
ユーザー | Tsukasa_Type |
提出日時 | 2018-02-10 22:49:31 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 465 bytes |
コンパイル時間 | 2,156 ms |
コンパイル使用メモリ | 74,824 KB |
実行使用メモリ | 56,276 KB |
最終ジャッジ日時 | 2024-04-24 06:36:04 |
合計ジャッジ時間 | 5,492 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 119 ms
41,596 KB |
testcase_01 | AC | 108 ms
41,584 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 110 ms
41,492 KB |
testcase_05 | AC | 112 ms
41,376 KB |
testcase_06 | WA | - |
testcase_07 | AC | 111 ms
40,888 KB |
testcase_08 | AC | 110 ms
41,712 KB |
testcase_09 | AC | 110 ms
41,320 KB |
testcase_10 | WA | - |
testcase_11 | AC | 109 ms
41,496 KB |
testcase_12 | WA | - |
testcase_13 | AC | 111 ms
41,588 KB |
testcase_14 | AC | 122 ms
41,848 KB |
testcase_15 | WA | - |
testcase_16 | AC | 113 ms
41,488 KB |
testcase_17 | AC | 114 ms
41,488 KB |
testcase_18 | WA | - |
testcase_19 | AC | 114 ms
41,528 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 132 ms
41,344 KB |
ソースコード
import java.util.*; public 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 num = 0; for (int i=0; i<n-2; i++) { int a = ar[i]; int b = ar[i+1]; int c = ar[i+2]; if (a!=b && b!=c) { if (a<b && b>c) {num++;} else if (a>b && b<c) {num++;} } } System.out.println(num); } }