結果
問題 | No.116 門松列(1) |
ユーザー |
![]() |
提出日時 | 2020-01-29 12:35:16 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 90 ms / 5,000 ms |
コード長 | 176 bytes |
コンパイル時間 | 41 ms |
コンパイル使用メモリ | 7,168 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-09-16 00:53:12 |
合計ジャッジ時間 | 3,259 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n Syntax OK
ソースコード
n = gets.chomp.to_ia = gets.chomp.split.map(&:to_i)ans = 0a.each_cons(3) do |c|mid = c.sort[1]ans += 1 if (c[0] == mid || c[2] == mid) && c.uniq.size == 3endputs ans