forked from HaochenLiu/My-Project-Euler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
076.cpp
49 lines (43 loc) · 867 Bytes
/
076.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
http://www.mathblog.dk/project-euler-76-one-hundred-sum-integers/
*/
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <stack>
#include <sstream>
#include <string.h>
#include <utility>
#include <vector>
using namespace std;
int main() {
int N = 100;
int* ways = new int[N + 1];
memset(ways, 0, sizeof(int) * (N + 1));
ways[0] = 1;
for (int i = 1; i < N; i++) {
for (int j = i; j <= N; j++) {
ways[j] += ways[j - i];
}
}
cout<<"Result "<<ways[N]<<endl;
int wait;
cin>>wait;
return 0;
}