結果

問題 No.138 化石のバージョン
ユーザー Rin
提出日時 2015-09-05 20:07:07
言語 Scheme
(Gauche-0.9.15)
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 1,350 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 5,376 KB
実行使用メモリ 16,000 KB
最終ジャッジ日時 2024-12-29 13:32:21
合計ジャッジ時間 2,615 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (System.out.println x)
  (begin
    (display x)
    (newline)
  )
)

(define (ver2num x)
  (let loop(
            (i 0)
            (foo 0)
            (bar '())
           )
    (if (= i (length x))
        (if (< foo 10)
            (string->number (apply string-append (reverse (cons (string-append "00" (number->string foo)) bar))))
            (if (< foo 100)
                (string->number (apply string-append (reverse (cons (string-append "0" (number->string foo)) bar))))
                (string->number (apply string-append (reverse (cons (number->string foo) bar))))
            )
        )
        (if (string=? (list->string (list (list-ref x i))) ".")
            (if (< foo 10)
                (loop (+ i 1) 0 (cons (string-append "00" (number->string foo)) bar))
                (if (< foo 100)
                    (loop (+ i 1) 0 (cons (string-append "0" (number->string foo)) bar))
                    (loop (+ i 1) 0 (cons (number->string foo) bar))
                )
            )
            (loop (+ i 1) (+ (* foo 10) (string->number (list->string (list (list-ref x i))))) bar)
        )
    )
  )
)

(let (
      (X (string->list (symbol->string (read))))
      (Y (string->list (symbol->string (read))))
     )
  (if (>= (ver2num X) (ver2num Y))
      (System.out.println "YES")
      (System.out.println "NO")
  )
)
0