結果

問題 No.116 門松列(1)
ユーザー simansiman
提出日時 2015-01-07 01:49:15
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 296 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 11,196 KB
実行使用メモリ 15,324 KB
最終ジャッジ日時 2023-09-03 22:12:52
合計ジャッジ時間 3,589 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 82 ms
15,148 KB
testcase_02 AC 81 ms
15,036 KB
testcase_03 AC 82 ms
15,324 KB
testcase_04 AC 82 ms
15,176 KB
testcase_05 AC 81 ms
15,072 KB
testcase_06 AC 82 ms
15,036 KB
testcase_07 AC 83 ms
15,100 KB
testcase_08 AC 82 ms
15,048 KB
testcase_09 AC 84 ms
15,252 KB
testcase_10 WA -
testcase_11 AC 84 ms
15,100 KB
testcase_12 AC 82 ms
15,104 KB
testcase_13 AC 83 ms
15,180 KB
testcase_14 WA -
testcase_15 AC 82 ms
15,260 KB
testcase_16 AC 82 ms
15,100 KB
testcase_17 AC 83 ms
15,212 KB
testcase_18 AC 81 ms
15,100 KB
testcase_19 AC 80 ms
15,040 KB
testcase_20 AC 80 ms
15,240 KB
testcase_21 AC 80 ms
15,216 KB
testcase_22 AC 81 ms
15,068 KB
testcase_23 AC 80 ms
15,108 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:3: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

class A
  def initialize
    n = gets.chomp.to_i
    a = gets.chomp.split(' ').map(&:to_i)

    count = 0

    a.each_cons(3) do |list|
      next if list.first == list.last

      if list.max == list[1] || list.min == list[1]
        count += 1
      end
    end

    puts count
  end
end

A.new
0