結果

問題 No.486 3 Straight Win(3連勝)
ユーザー hebiyanhebiyan
提出日時 2017-05-22 15:27:17
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 643 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 5,328 KB
実行使用メモリ 13,656 KB
最終ジャッジ日時 2023-09-08 11:08:40
合計ジャッジ時間 2,077 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
11,592 KB
testcase_01 AC 18 ms
11,632 KB
testcase_02 AC 18 ms
11,792 KB
testcase_03 AC 18 ms
11,712 KB
testcase_04 AC 18 ms
11,760 KB
testcase_05 AC 19 ms
13,656 KB
testcase_06 AC 18 ms
11,544 KB
testcase_07 AC 18 ms
11,620 KB
testcase_08 AC 19 ms
13,572 KB
testcase_09 AC 18 ms
11,636 KB
testcase_10 AC 18 ms
11,800 KB
testcase_11 AC 18 ms
11,592 KB
testcase_12 AC 19 ms
11,768 KB
testcase_13 AC 18 ms
11,704 KB
testcase_14 AC 19 ms
11,788 KB
testcase_15 AC 18 ms
11,764 KB
testcase_16 AC 18 ms
11,644 KB
testcase_17 AC 18 ms
11,676 KB
testcase_18 AC 18 ms
11,656 KB
testcase_19 AC 18 ms
11,672 KB
testcase_20 AC 18 ms
11,672 KB
testcase_21 AC 18 ms
11,668 KB
testcase_22 AC 19 ms
11,808 KB
testcase_23 AC 18 ms
11,780 KB
testcase_24 AC 18 ms
11,676 KB
testcase_25 AC 18 ms
11,672 KB
testcase_26 AC 18 ms
11,672 KB
testcase_27 AC 18 ms
11,776 KB
権限があれば一括ダウンロードができます

ソースコード

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