Submission #4186943


Source Code Expand

structure A  = Array
structure I  = Int
structure L  = List
structure SC = StringCvt
structure T  = TextIO

fun nextInt () = valOf (T.scanStream (I.scan SC.DEC) T.stdIn)

val () =
    let
        val ary = A.array (2500, [])
        val N = nextInt ()
        val i = ref 9
        val j = ref 9
        val s = ref 0
    in
        i := 9;
        while !i >= 1 do (
            j := 9;
            while !j >= 1 do (
                s := !s + !i * !j;
                A.update (ary, !i * !j, (!i, !j)::A.sub (ary, !i * !j));
                j := !j - 1
            );
            i := !i - 1
        );
        L.app (fn (i, j) => print (I.toString i ^ " x " ^ I.toString j ^ "\n"))
              (A.sub (ary, !s - N))
    end

Submission Info

Submission Time
Task C - 九九足し算
User masquerade0324
Language Standard ML (MLton 20100608)
Score 100
Code Size 758 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 20
Set Name Test Cases
All sample_01.txt, sample_02.txt, test_1953.txt, test_1971.txt, test_1977.txt, test_1983.txt, test_1989.txt, test_1990.txt, test_1993.txt, test_1995.txt, test_1997.txt, test_1998.txt, test_2001.txt, test_2009.txt, test_2013.txt, test_2017.txt, test_2019.txt, test_2020.txt, test_2022.txt, test_2024.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
test_1953.txt AC 1 ms 256 KB
test_1971.txt AC 1 ms 256 KB
test_1977.txt AC 1 ms 256 KB
test_1983.txt AC 1 ms 256 KB
test_1989.txt AC 1 ms 256 KB
test_1990.txt AC 1 ms 256 KB
test_1993.txt AC 1 ms 256 KB
test_1995.txt AC 1 ms 256 KB
test_1997.txt AC 1 ms 256 KB
test_1998.txt AC 1 ms 256 KB
test_2001.txt AC 1 ms 256 KB
test_2009.txt AC 1 ms 256 KB
test_2013.txt AC 1 ms 256 KB
test_2017.txt AC 1 ms 256 KB
test_2019.txt AC 1 ms 256 KB
test_2020.txt AC 1 ms 256 KB
test_2022.txt AC 1 ms 256 KB
test_2024.txt AC 1 ms 256 KB