結果

問題 No.116 門松列(1)
コンテスト
ユーザー neko_the_shadow
提出日時 2016-11-28 00:23:02
言語 Scheme
(Gauche-0.9.15)
コンパイル:
true
実行:
gosh _filename_
結果
AC  
実行時間 18 ms / 5,000 ms
コード長 485 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 69 ms
コンパイル使用メモリ 7,972 KB
実行使用メモリ 16,256 KB
最終ジャッジ日時 2026-03-11 06:03:27
合計ジャッジ時間 1,450 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

(define (f x y z)
  (and (not (= x y))
       (not (= y z))
       (not (= z x))
       (or (= y (max x y z))
           (= y (min x y z)))))

(define (MAIN)
  (let* ((n (string->number (read-line)))
         (ls (map string->number (string-split (read-line) #\space))))
    (let loop ((numbers ls) (size n) (cnt 0))
      (if (< size 3)
        (print cnt)
        (loop (cdr numbers) 
              (- size 1)
              (if (apply f (take numbers 3)) (+ 1 cnt) cnt))))))


(MAIN)
0