Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- #include <numeric>
- #include <algorithm>
- #include <string>
- #include <sstream>
- #include <set>
- #include <map>
- #include <unordered_map>
- #include <vector>
- #include <stack>
- #include <deque>
- using namespace std;
- long long factorial(long long n){
- long long ans=1;
- for (long long i=1; i<=n; i++) {
- ans*=i;
- }
- return ans;
- }
- int main() {
- ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
- long long n;
- cin >> n;
- long long y=1;
- long long z=1;
- for (long long i=1; i<=n; i++) {
- z*=i;
- }
- for (long long i=1; i<n-1; i++) {
- long long x;
- cin >> x;
- y*=x;
- }
- long long ans=z/y;
- cout << ans;
- return 0;
- }
- /*
- *
- int n;
- 5
- 2 3 4
- 1
- 2 3
- 3 4 5
- 1 1 9
- */
Advertisement
Add Comment
Please, Sign In to add comment