結果

問題 No.495 (^^*) Easy
コンテスト
ユーザー hebiyan
提出日時 2017-05-18 00:51:22
言語 Scheme
(Gauche-0.9.15)
コンパイル:
true
実行:
gosh _filename_
結果
AC  
実行時間 30 ms / 2,000 ms
+ 359µs
コード長 476 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 47 ms
コンパイル使用メモリ 7,728 KB
実行使用メモリ 17,920 KB
最終ジャッジ日時 2026-11-10 14:22:26
合計ジャッジ時間 1,750 ms
ジャッジサーバーID
(参考情報)
judge7_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

(use srfi-1)

(define (count-direction s l r)
  (cond
   ((or (null? s) (char=? #\# (car s))) `(,l ,r))
   (else
    (case (list-ref s 3)
      ((#\*)
       (count-direction (drop s 5) (+ 1 l) r))
      ((#\^)
       (count-direction (drop s 5) l (+ 1 r)))
      (else
       (count-direction (drop s 5) l r))))))

(letrec ((line (read-line))
         (lr (count-direction (string->list line)
                              0 0)))
  (format #t "~a ~a\n" (car lr) (cadr lr)))
0