結果
| 問題 |
No.116 門松列(1)
|
| ユーザー |
horiesiniti
|
| 提出日時 | 2016-06-14 12:14:44 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 92 ms / 5,000 ms |
| コード長 | 243 bytes |
| コンパイル時間 | 99 ms |
| コンパイル使用メモリ | 7,296 KB |
| 実行使用メモリ | 12,416 KB |
| 最終ジャッジ日時 | 2024-06-25 01:18:30 |
| 合計ジャッジ時間 | 3,109 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n Syntax OK
ソースコード
n=STDIN.gets.to_i
as=STDIN.gets.split(" ")
as.size.times do |i|
as[i]=as[i].to_i
end
ans=0
0.upto(as.size-3) do |i|
a=as[i]
b=as[i+1]
c=as[i+2]
if a>b && b<c && a!=c then
ans+=1
elsif a<b && b>c && a!=c then
ans+=1
end
end
puts ans
horiesiniti