結果

問題 No.687 E869120 and Constructing Array 1
コンテスト
ユーザー tanson
提出日時 2025-11-08 01:26:03
言語 Standard ML
(MLton 20210117)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 516 bytes
コンパイル時間 5,702 ms
コンパイル使用メモリ 687,096 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-11-08 01:26:10
合計ジャッジ時間 4,393 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

fun readInt () =
    valOf (TextIO.scanStream (Int.scan StringCvt.DEC) TextIO.stdIn)


val () =
    let
        val n = readInt ()

        exception E
        exception Found of (int * int)
        fun findAns i j =
            if 10 < i then raise E
            else if 10 < j then findAns (i + 1) 1
            else if i + j = n then raise Found (i, j)
            else findAns i (j + 1)
    in
        (findAns 1 1)
        handle Found (a1, a2) => print (Int.toString a1 ^ " " ^ Int.toString a2 ^ "\n")
    end
0