結果

問題 No.1237 EXP Multiple!
ユーザー keymoonkeymoon
提出日時 2020-09-25 21:29:20
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,109 bytes
コンパイル時間 5,650 ms
コンパイル使用メモリ 104,304 KB
実行使用メモリ 47,236 KB
最終ジャッジ日時 2023-09-10 14:55:01
合計ジャッジ時間 8,876 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
21,740 KB
testcase_01 AC 139 ms
41,988 KB
testcase_02 AC 164 ms
46,880 KB
testcase_03 AC 166 ms
47,236 KB
testcase_04 AC 176 ms
47,120 KB
testcase_05 AC 121 ms
37,272 KB
testcase_06 AC 129 ms
35,960 KB
testcase_07 AC 122 ms
35,200 KB
testcase_08 AC 127 ms
37,892 KB
testcase_09 AC 121 ms
35,204 KB
testcase_10 AC 121 ms
35,216 KB
testcase_11 RE -
testcase_12 AC 129 ms
38,032 KB
testcase_13 AC 128 ms
35,948 KB
testcase_14 AC 132 ms
35,844 KB
testcase_15 AC 128 ms
38,040 KB
testcase_16 AC 128 ms
37,908 KB
testcase_17 AC 127 ms
35,848 KB
testcase_18 AC 128 ms
37,872 KB
testcase_19 AC 125 ms
35,948 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());
        var a = Console.ReadLine().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