結果

問題 No.1237 EXP Multiple!
ユーザー keymoonkeymoon
提出日時 2020-09-25 21:30:07
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,123 bytes
コンパイル時間 5,444 ms
コンパイル使用メモリ 106,880 KB
実行使用メモリ 46,712 KB
最終ジャッジ日時 2023-09-10 14:56:07
合計ジャッジ時間 5,961 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
21,628 KB
testcase_01 AC 136 ms
39,936 KB
testcase_02 AC 162 ms
46,712 KB
testcase_03 AC 165 ms
45,116 KB
testcase_04 AC 173 ms
45,036 KB
testcase_05 AC 120 ms
35,240 KB
testcase_06 AC 129 ms
35,980 KB
testcase_07 AC 122 ms
35,360 KB
testcase_08 AC 128 ms
37,992 KB
testcase_09 AC 122 ms
37,320 KB
testcase_10 AC 122 ms
37,316 KB
testcase_11 RE -
testcase_12 AC 128 ms
35,804 KB
testcase_13 AC 128 ms
38,032 KB
testcase_14 AC 127 ms
35,912 KB
testcase_15 AC 134 ms
36,140 KB
testcase_16 AC 128 ms
37,816 KB
testcase_17 AC 128 ms
35,908 KB
testcase_18 AC 128 ms
35,848 KB
testcase_19 AC 126 ms
38,040 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine().Trim());
        var a = Console.ReadLine().Trim().Split().Select(int.Parse).ToArray();
        if (a.Contains(0))
        {
            Console.WriteLine(-1);
            return;
        }

        long res = 1;
        foreach (var item in a)
        {
            long factorial = 1;
            for (int i = 1; i <= item; i++)
            {
                factorial *= i;
                if (32 <= factorial) goto over;
            }
            
            for (int i = 0; i < factorial; i++)
            {
                res *= item;
                if (1000000007 < factorial) goto over;
            }
        }

        Console.WriteLine(1000000007 % res);
        return;
        over:;
        Console.WriteLine(1000000007);
    }
}
0