There are exactly ten ways of selecting three from five, 12345:

123, 124, 125, 134, 135, 145, 234, 235, 245, and 345

In combinatorics, we use the notation, 5C3 = 10.

In general,

nCr =
n!
r!(n−r)!
,where r ≤ nn! = n×(n−1)×...×3×2×1, and 0! = 1.

It is not until n = 23, that a value exceeds one-million: 23C10 = 1144066.

How many, not necessarily distinct, values of  nCr, for 1 ≤ n ≤ 100, are greater than one-million?

#include <iostream>
#include <string>
using namespace std;int c[101][101];int main()
{memset(c, 0, sizeof(c));for (int i = 1; i <= 100; i++){c[0][i] = 1;c[1][i] = i;c[i][i] = 1;c[i - 1][i] = i;}int count = 0;for (int n = 2; n <= 100; n++){for (int r = 2; r < n; r++){c[r][n] = c[r][n - 1] + c[r - 1][n - 1];if (c[r][n]>1000000){c[r][n] = 1000001;count++;}}}cout << count << endl;system("pause");return 0;
}

Project Euler:Problem 53 Combinatoric selections相关推荐

  1. Project Euler:Problem 39 Integer right triangles

    If p is the perimeter of a right angle triangle with integral length sides, {a,b,c}, there are exact ...

  2. 欧拉计划 Project Euler 50-56

    Project Euler 50-56 Project Euler: https://projecteuler.net/ Project Euler | 欧拉计划: https://pe-cn.git ...

  3. Project Euler Problem 53: Combinatoric selections【组合数】

    PE其他解题报告请参考这里,本题答案在留言首条 Combinatoric selections Problem 53 There are exactly ten ways of selecting t ...

  4. 欧拉计划:第53题 Combinatoric selections

    欧拉计划:第53题 Combinatoric selections 无意中知道有这个用编程解决数学题的网站,个人对数学又比较感兴趣,所以打算做个欧拉计划系列,将自己的一些见解分享给大家,第一次写文章, ...

  5. Project Euler Problem 27小结

    Project Euler上有很多有意思的问题,刚做到第27题,对这个问题做个小结. Problem 27: Euler有一个著名的方程n^2+n+41,当n=0到39时,方程结果均为质数.如今人们用 ...

  6. Project Euler Problem 104 Pandigital Fibonacci ends

    Pandigital Fibonacci ends Problem 104 The Fibonacci sequence is defined by the recurrence relation: ...

  7. Project Euler Problem 66

    Problem 66 Consider quadratic Diophantine equations of the form: x2 – Dy2 = 1 For example, when D=13 ...

  8. 【AlgorithmTraining】03:Project Euler 03

    Project Euler 03 OVERVIEW Project Euler 03 1.E22:Name score 2.E32:Pandigital products 3.E33:Digit ca ...

  9. Project Euler

    最近发现了一个很有趣的网站,Project Euler 上面全是数学题,不过大多需要用编程解决 Problem 3: 求:600851475143的最大素因子. 解:编了个程序,迅速水过,看官方的题解 ...

最新文章

  1. 【莓控】黑莓8110中文说明书
  2. 《Linux与unix Shell编程指南》 总结
  3. mybatis框架--学习笔记(下)
  4. c语言在win8系统不兼容,Win8系统中存在不兼容软件怎么办?
  5. 不愧是阿里大佬,mysql存储过程写法案例
  6. LeetCode228场周赛解题报告
  7. 统计学硕士做了3年表格,多次跳槽失败,只因学不会数据工具
  8. Linux命令行技巧
  9. window 右击菜单启动 nodejs app
  10. 【Leetcode_easy】1103. Distribute Candies to People
  11. 第七章思维导图前半段
  12. XDU暑训2019 Day4 POJ2387
  13. Linux CentOS 7 多网卡配置bond模式 bond1 bond5 bond6
  14. (Django)Web网页导入pycharm时遇到的问题集合(备份)
  15. AndroidStudio恢复误删文件
  16. python rewind_C语言rewind和fseek函数的用法详解(随机读写文件)
  17. python安装教程(Win8环境)
  18. unity把公共方法在Inspector 界面上实现一个按钮点击直接调用的最快最方便的方式
  19. 实现个虚拟机只要几百行的 toy 版就够了
  20. 使用git在项目中的一些经验

热门文章

  1. YOLOv7 训练前手动计算锚定框
  2. MD5暴力碰撞对王玉斌讲解PPT的总结
  3. 五脚18.8数码管显示
  4. python计算ks值 代码_python画KS图,求KS值
  5. python词云生成的图片为空白图片
  6. AD之PCB各层说明
  7. MySQL:使用PMM进行性能监控
  8. 同学用javascript写好了论坛自动灌水机。
  9. 冬天来了,分享几个网页下雪js特效
  10. 全息投影马戏团,好有爱的科技呀~