记录编号 73267 评测结果 AAAAAAAAAA
题目名称 分裂 最终得分 100
用户昵称 GravatarEzoi_XY 是否通过 通过
代码语言 Pascal 运行时间 0.740 s
提交时间 2013-10-21 08:04:59 内存使用 0.18 MiB
显示代码纯文本
Program cog609;
    Type
        Bn=Record
               L:Longint;
               N:Array[0..5000]Of Longint;
           End;
    Var
        N,I,J,M:Longint;
        A:Bn;
    Begin
        Assign(Input,'mushroom.in');
        Assign(Output,'mushroom.out');
        Reset(Input);
        Rewrite(Output);
        Readln(N);
        A.L:=1;
        A.N[1]:=1;
        For J:=N Shr 1+1 To N Do
            Begin
                A.N[A.L+1]:=0;
                For I:=1 To A.L+1 Do
                    Begin
                        A.N[I]:=A.N[I]*J;
                        If A.N[I-1]>=10000 Then
                            Begin
                                Inc(A.N[I],A.N[I-1] Div 10000);
                                A.N[I-1]:=A.N[I-1] Mod 10000;
                            End;
                    End;
                If A.N[A.L+1]<>0 Then Inc(A.L);
            End;
        For J:=1 To N-N Shr 1 Do
            Begin
                M:=0;
                For I:=A.L Downto 1 Do
                    Begin
                        Inc(A.N[I],M*10000);
                        M:=A.N[I] Mod J;
                        A.N[I]:=A.N[I] Div J;
                    End;
                While (A.L<>1) And (A.N[A.L]=0) Do Dec(A.L);
            End;
        Write(A.N[A.L]);
        For I:=A.L-1 Downto 1 Do
            Begin
                If A.N[I]<1000 Then Write(0);
                If A.N[I]<100 Then Write(0);
                If A.N[I]<10 Then Write(0);
                Write(A.N[I]);
            End;
        Writeln;
        Close(Input);
        Close(Output);
    End.