Advertisement
TimxAG

Untitled

Oct 15th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #include <inttypes.h>
  3. using namespace std;
  4. //#define red uint64;
  5. int main() {
  6. uint64_t n;
  7. cin >> n;
  8.  
  9. uint64_t res = 0, a;
  10. cin >> res;
  11. for (uint64_t i = 1; i < n; i++) {
  12. cin >> a;
  13. res = res^a;
  14. }
  15. //cout << res%2 << endl;
  16. uint64_t ans = 0;
  17. if (res%2 == 1) {cout << 0 << endl; return 0;}
  18.  
  19.  
  20. for (uint64_t k = 1; k < n; k++) {
  21. uint64_t x = 1;
  22. uint64_t l = 1;
  23. for (uint64_t j = k+1; j <= n; j++) {
  24. x *= j;
  25. if (l <= n - k && x%l == 0) {
  26. x /= l; l++;
  27. }
  28. }
  29.  
  30. //cout << "x = " <<x << endl;
  31. ans += x;
  32. }
  33. cout << ans << endl;
  34.  
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement