結果

問題 No.486 3 Straight Win(3連勝)
ユーザー hebiyan
提出日時 2017-05-22 15:27:17
言語 Scheme
(Gauche-0.9.15)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 643 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 6,944 KB
実行使用メモリ 16,128 KB
最終ジャッジ日時 2024-06-26 04:27:25
合計ジャッジ時間 1,830 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (shori-hantei xs)
  (letrec ((len (string-length xs))
           (inner
            (lambda (m east west)
              (cond
               ((= 3 east) "East")
               ((= 3 west) "West")
               ((<= len m) "NA")
               (else
                (let ((ch (string-ref xs m)))
                  (cond
                   ((char=? ch #\O)
                    (inner (+ 1 m) (+ 1 east) 0))
                   ((char=? ch #\X)
                    (inner (+ 1 m) 0 (+ 1 west)))
                   (else
                    (inner (+ 1 m) east west)))))))))
    (inner 0 0 0)))

(print (shori-hantei (read-line))) 
      
0