結果
問題 |
No.113 宝探し
|
ユーザー |
![]() |
提出日時 | 2015-09-04 20:01:59 |
言語 | Scheme (Gauche-0.9.15) |
結果 |
AC
|
実行時間 | 24 ms / 5,000 ms |
コード長 | 899 bytes |
コンパイル時間 | 135 ms |
コンパイル使用メモリ | 6,688 KB |
実行使用メモリ | 16,128 KB |
最終ジャッジ日時 | 2024-11-16 20:59:22 |
合計ジャッジ時間 | 2,228 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
(define (System.out.println x) (begin (display x) (newline) ) ) (let ( (foo (symbol->string (read))) (bar (list 0 0)) (i 0) ) (let loop( (baz (list->string (list (string-ref foo 0)))) ) (begin (cond ((string=? baz "N") (set! bar (list (list-ref bar 0) (+ (list-ref bar 1) 1)))) ((string=? baz "E") (set! bar (list (+ (list-ref bar 0) 1) (list-ref bar 1)))) ((string=? baz "W") (set! bar (list (- (list-ref bar 0) 1) (list-ref bar 1)))) ((string=? baz "S") (set! bar (list (list-ref bar 0) (- (list-ref bar 1) 1)))) ) (if (= i (- (string-length foo) 1)) (System.out.println (sqrt (+ (expt (list-ref bar 0) 2) (expt (list-ref bar 1) 2)))) (begin (set! i (+ i 1)) (loop (list->string (list (string-ref foo i)))) ) ) ) ) )