牛牛的数字集合

在这里插入图片描述
大致猜一下就知道是连乘积,但是依然还是要证明一下的。

在这里插入图片描述
直接输入的时候连乘取模就可以了

#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const double pi = 3.141592653589;
const int mod = 1e9 + 7;
const int N = 1e6 + 7;
int n;
int a[N];
int main(){
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
	cin >> n;
	ll ans = 1;
	for (int i = 0; i < n; i++){
		scanf("%d", a + i);
		ans = (ans * a[i]) % mod;
	}
	printf("%lld\n", ans);
	return 0;
}
posted @ 2022-08-03 19:07  correct  阅读(55)  评论(0)    收藏  举报