結果

問題 No.116 門松列(1)
ユーザー hadrorihadrori
提出日時 2015-07-26 15:28:14
言語 Ruby
(3.2.2)
結果
AC  
実行時間 100 ms / 5,000 ms
コード長 176 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 11,224 KB
実行使用メモリ 15,312 KB
最終ジャッジ日時 2023-09-07 06:46:10
合計ジャッジ時間 4,287 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,132 KB
testcase_01 AC 80 ms
15,140 KB
testcase_02 AC 81 ms
15,116 KB
testcase_03 AC 82 ms
15,132 KB
testcase_04 AC 81 ms
15,208 KB
testcase_05 AC 81 ms
15,256 KB
testcase_06 AC 82 ms
15,216 KB
testcase_07 AC 83 ms
15,308 KB
testcase_08 AC 100 ms
15,024 KB
testcase_09 AC 81 ms
15,132 KB
testcase_10 AC 81 ms
15,132 KB
testcase_11 AC 81 ms
15,128 KB
testcase_12 AC 81 ms
15,312 KB
testcase_13 AC 81 ms
15,112 KB
testcase_14 AC 85 ms
15,224 KB
testcase_15 AC 82 ms
15,208 KB
testcase_16 AC 82 ms
15,256 KB
testcase_17 AC 91 ms
15,304 KB
testcase_18 AC 82 ms
15,292 KB
testcase_19 AC 82 ms
15,068 KB
testcase_20 AC 82 ms
15,136 KB
testcase_21 AC 81 ms
15,264 KB
testcase_22 AC 81 ms
15,172 KB
testcase_23 AC 82 ms
15,128 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n=gets.to_i
a=gets.split.map(&:to_i)
sum = 0
(n-2).times do |i|
  b = a[i,3].sort
  next if b[0] == b[1] or b[1] == b[2]
  sum += 1 if a[i] == b[1] or a[i+2] == b[1]
end
p sum
0