結果

問題 No.1237 EXP Multiple!
ユーザー furafura
提出日時 2020-09-26 17:08:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 515 bytes
コンパイル時間 4,627 ms
コンパイル使用メモリ 199,492 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-11 14:56:06
合計ジャッジ時間 4,517 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 16 ms
4,380 KB
testcase_06 AC 17 ms
4,376 KB
testcase_07 AC 16 ms
4,376 KB
testcase_08 AC 16 ms
4,376 KB
testcase_09 AC 17 ms
4,376 KB
testcase_10 AC 16 ms
4,380 KB
testcase_11 AC 17 ms
4,376 KB
testcase_12 AC 16 ms
4,380 KB
testcase_13 AC 16 ms
4,376 KB
testcase_14 AC 17 ms
4,380 KB
testcase_15 AC 16 ms
4,376 KB
testcase_16 AC 16 ms
4,376 KB
testcase_17 AC 16 ms
4,380 KB
testcase_18 AC 17 ms
4,380 KB
testcase_19 AC 16 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

const int MOD=1e9+7;

int main(){
	int n; scanf("%d",&n);
	vector<int> a(n);
	rep(i,n) scanf("%d",&a[i]);

	if(count(a.begin(),a.end(),0)>0){
		puts("-1");
		return 0;
	}

	lint ans=1;
	rep(i,n) if(a[i]>1) {
		lint fact=1;
		rep(j,a[i]){
			fact*=j+1;
			if(fact>100) break;
		}
		if(fact>100) continue;

		rep(j,fact){
			if(ans>MOD) break;
			ans*=a[i];
		}
	}
	printf("%lld\n",MOD%ans);

	return 0;
}
0