-
Notifications
You must be signed in to change notification settings - Fork 0
/
eu0023.cpp
55 lines (43 loc) · 1.15 KB
/
eu0023.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
50
51
52
53
54
55
#include"eu0023.h"
#include"principal.h"
void eu0023 :: solucion(){
// ---------------------------------------------------- //
tstart = (double)clock()/CLOCKS_PER_SEC;
// ---------------------------------------------------- //
output = 0;
tem_1d_1 = new unsigned long long[6965];
tem_1d_2 = new unsigned long long[28124];
// ---------------------------------------------------- //
temp_1 = 0;
tem_1d_2[0] = 0;
for( unsigned long long i=1; i<=28123; i++ ){
tem_1d_2[i] = 0;
temp_2 = sumprop( i );
if( temp_2 > i ){
tem_1d_1[temp_1] = i;
temp_1 ++;
}
}
for( unsigned long long i=0; i<6965; i++ ){
for( unsigned long long j=0; j<6965; j++ ){
temp_2 = tem_1d_1[i]+tem_1d_1[j];
if( temp_2 < 28124 ){
tem_1d_2[temp_2] = 1;
}
}
}
for( long i=28123; i>0; i-- ){
if( tem_1d_2[i] == 0 ){
output = output+i;
}
}
// ---------------------------------------------------- //
tstop = (double)clock()/CLOCKS_PER_SEC;
ttime= tstop-tstart;
// ---------------------------------------------------- //
}
void eu0023 :: printsolution(){
cout << "Euler 0023\n";
cout << "Time: " << ttime << "\n";
cout << output;
}