제출 #862607

#제출 시각아이디문제언어결과실행 시간메모리
862607Mizo_CompilerMagneti (COCI21_magneti)C++17
0 / 110
0 ms348 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double ld; #define pb push_back #define sz(x) int(x.size()) #define all(x) x.begin(),x.end() #define F first #define S second const int N = 50, M = 1e9+7, L = 1e4; int n, l, r[N]; ll fact[L+2]; ll fp(ll b, ll p) { ll ret = 1; while (p) { if ((p & 1))ret = (ret * b) % M; b = (b * b) % M; p >>= 1; } return ret; } ll nCr(int a, int b) { return (fact[a] * fp((fact[b] * fact[n-b])%M, M-2))%M; } int main () { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> l; fact[0] = 1; for (ll i = 1; i <= L; i++) { fact[i] = (fact[i-1] * i) % M; } for (int i = 0; i < n; i++) { cin >> r[i]; } cout << (fact[n] * nCr(l - (n-1) * (r[0]-1), n)); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...