結果
| 問題 |
No.116 門松列(1)
|
| ユーザー |
toshiro_yanagi
|
| 提出日時 | 2022-06-14 22:19:17 |
| 言語 | Go (1.23.4) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 363 bytes |
| コンパイル時間 | 10,864 ms |
| コンパイル使用メモリ | 241,192 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-03 01:17:26 |
| 合計ジャッジ時間 | 12,000 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
package main
import "fmt"
func main() {
var (
n int
a []int
)
fmt.Scan(&n)
for range make([]struct{}, n) {
var ai int
fmt.Scan(&ai)
a = append(a, ai)
}
ans := 0
for i := range make([]struct{}, n-2) {
x := a[i]
y := a[i+1]
z := a[i+2]
if x == z {
} else if (y > x && y > z) || (y < x && y < z) {
ans++
}
}
fmt.Println(ans)
}
toshiro_yanagi