結果
問題 |
No.116 門松列(1)
|
ユーザー |
![]() |
提出日時 | 2016-11-28 00:23:02 |
言語 | Scheme (Gauche-0.9.15) |
結果 |
AC
|
実行時間 | 25 ms / 5,000 ms |
コード長 | 485 bytes |
コンパイル時間 | 49 ms |
コンパイル使用メモリ | 5,376 KB |
実行使用メモリ | 16,128 KB |
最終ジャッジ日時 | 2024-06-25 01:25:36 |
合計ジャッジ時間 | 1,650 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
(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)