Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <gmpxx.h>
- mpz_class C(int n, int r)
- {
- mpz_class fact_n;
- mpz_class fact_r;
- mpz_class fact_n_r;
- mpz_fac_ui(fact_n.get_mpz_t(), n);
- mpz_fac_ui(fact_r.get_mpz_t(), r);
- mpz_fac_ui(fact_n_r.get_mpz_t(), n-r);
- return fact_n / (fact_r * fact_n_r);
- }
- int main()
- {
- int count = 0, mcount;
- for (int n=23; n<=100; n++)
- {
- mcount = 0;
- for (int r=0; r<=n; r++, mcount++)
- {
- if (C(n, r) > 1000000)
- break;
- }
- count += n - 2*mcount + 1;
- }
- std::cout << count << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement