lina_os

Untitled

Feb 13th, 2025
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cmath>
  4. #include <numeric>
  5. #include <algorithm>
  6. #include <string>
  7. #include <sstream>
  8. #include <set>
  9. #include <map>
  10. #include <unordered_map>
  11. #include <vector>
  12. #include <stack>
  13. #include <deque>
  14.  
  15. using namespace std;
  16.  
  17. long long factorial(long long n){
  18. long long ans=1;
  19. for (long long i=1; i<=n; i++) {
  20. ans*=i;
  21. }
  22. return ans;
  23. }
  24.  
  25. int main() {
  26. ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  27. long long n;
  28. cin >> n;
  29. long long y=1;
  30. long long z=1;
  31. for (long long i=1; i<=n; i++) {
  32. z*=i;
  33. }
  34. for (long long i=1; i<n-1; i++) {
  35. long long x;
  36. cin >> x;
  37. y*=x;
  38. }
  39. long long ans=z/y;
  40. cout << ans;
  41. return 0;
  42. }
  43.  
  44. /*
  45. *
  46. int n;
  47. 5
  48. 2 3 4
  49. 1
  50. 2 3
  51. 3 4 5
  52. 1 1 9
  53. */
Advertisement
Add Comment
Please, Sign In to add comment