結果

問題 No.116 門松列(1)
ユーザー neko_the_shadowneko_the_shadow
提出日時 2016-11-28 00:23:02
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 21 ms / 5,000 ms
コード長 485 bytes
コンパイル時間 65 ms
コンパイル使用メモリ 5,216 KB
実行使用メモリ 11,932 KB
最終ジャッジ日時 2023-09-07 07:06:39
合計ジャッジ時間 1,882 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
11,732 KB
testcase_01 AC 19 ms
11,820 KB
testcase_02 AC 19 ms
11,732 KB
testcase_03 AC 21 ms
11,912 KB
testcase_04 AC 20 ms
11,656 KB
testcase_05 AC 19 ms
11,680 KB
testcase_06 AC 18 ms
11,920 KB
testcase_07 AC 19 ms
11,760 KB
testcase_08 AC 18 ms
11,920 KB
testcase_09 AC 19 ms
11,832 KB
testcase_10 AC 19 ms
11,920 KB
testcase_11 AC 19 ms
11,788 KB
testcase_12 AC 18 ms
11,780 KB
testcase_13 AC 18 ms
11,788 KB
testcase_14 AC 18 ms
11,888 KB
testcase_15 AC 19 ms
11,736 KB
testcase_16 AC 19 ms
11,760 KB
testcase_17 AC 19 ms
11,884 KB
testcase_18 AC 19 ms
11,856 KB
testcase_19 AC 18 ms
11,780 KB
testcase_20 AC 19 ms
11,932 KB
testcase_21 AC 17 ms
11,900 KB
testcase_22 AC 20 ms
11,768 KB
testcase_23 AC 18 ms
11,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

(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