forked from wandering007/ProjectEuler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP100.cpp
More file actions
39 lines (39 loc) · 888 Bytes
/
Copy pathP100.cpp
File metadata and controls
39 lines (39 loc) · 888 Bytes
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
#include<iostream>
#include<fstream>
#include<string>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<iomanip>
#define MIN 1000000000000
#define MOD 1000000
#define LL long long
#define eps 1e-8
#define inf 0x3f3f3f3f
using namespace std;
//http://www.alpertron.com.ar/QUAD.HTM
// 2 * x^2 - y^2 - 2 * x + y = 0
int main()
{
clock_t start = clock();
LL x = 1LL, y = 1LL, tmp_x;
while(y <= MIN)
{
tmp_x = 3 * x + 2 * y - 2;
y = 4 * x + 3 * y - 3;
x = tmp_x;
}
printf("The number of blue discs: %I64d.\n%I64d discs in total.\n", x, y);
printf("time cost: %lf s.", (double)(clock() - start) / CLOCKS_PER_SEC);
return 0;
}