Eularproject 76:Counting summations
来源:互联网 发布:4518无法网络打印 编辑:程序博客网 时间:2024/06/07 02:37
Andrew Zhang
Jul 16, 2017
It is possible to write five as a sum in exactly six different ways:
4 + 1
3 + 2
3 + 1 + 1
2 + 2 + 1
2 + 1 + 1 + 1
1 + 1 + 1 + 1 + 1
How many different ways can one hundred be written as a sum of at least two positive integers?
Answer:
190569291
Completed on Sun, 16 Jul 2017, 00:58
Go to the thread for problem 76 in the forum.
题目解析:
简单dp。
#include <iostream>using namespace std;#define SIZE 105int main(){ int state[SIZE][SIZE]; for (int i = 0; i <= 100; i++) { for (int j = 0; j <= i; j++) { if ((i <= 1) || (j <= 1)) { state[i][j] = 1; continue; }else{ state[i][j] = state[i - j][j] + state[i][j - 1]; continue; } } for (int j = i + 1; j <= 100; j++) { state[i][j] = state[i][i]; } } cout << state[100][100] << endl; return 0;}
阅读全文
1 0
- Eularproject 76:Counting summations
- Project Euler:Problem 76 Counting summations
- EularProject 85:Counting rectangles
- EularProject 73:Counting fractions in a range
- projecteuler No.77 Prime summations
- EularProject 35:循环素数
- EularProject 99:Largest exponential
- EularProject 71:Ordered fractions
- EularProject 66:Diophantine equation
- Project Euler:Problem 77 Prime summations
- EularProject 64: 平方根的周期性
- EularProject 19: 星期日的个数
- EularProject 48: 利用数组求和
- EularProject 74:Digit factorial chains
- EularProject 61:Cyclical figurate numbers
- Project Euler #77: Prime summations 回溯法得不到满分
- EularProject 7: 计算10001个素数
- EularProject 15: 方格迷宫的路径数
- AtCoder Regular Contest 078-D
- 循环冗余检验CRC
- java提高篇(四)-----理解java的三大特性之多态
- 设计一个类只能在堆(栈)上创建
- junit单元测试通过mybatis查询数据库时在Test方法加上@Transactional注解查询速度居然平均快5倍
- Eularproject 76:Counting summations
- eclipse maven创建一个maven web项目,以及创建过程中的报错解决方法
- 刷机知识
- linux vsftp“ftp: connect: No route to host” and "connect: Connection refused"
- Scrapy followlinks总结
- Java提高篇——equals()与hashCode()方法详解
- “玲珑杯”ACM比赛 Round #18
- CSS性能优化
- ES(elasticsearch)搜索引擎安装和使用