-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgroceryStore.cpp
44 lines (38 loc) · 1.19 KB
/
groceryStore.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
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <vector>
using namespace std;
ofstream fout("groceryStore.out");
int main()
{
fout << fixed << setprecision(2);
//int a=(int)1e8;
for (long long a = 1; a * a * a * a < 16000000000000 && a * 4 <= 2000; ++a)
{
for (long long b = a; b * b * b * a < 16000000000000 && b * 3 + a <= 2000; ++b)
{
for (long long c = b; c * c * b * a < 16000000000000 && c * 2 + b + a <= 2000; ++c)
{
if (a * b * c > 1000000)
{
if ((1000000 * (a + b + c)) % (a * b * c - 1000000) == 0)
{
long long d = (1000000 * (a + b + c)) / (a * b * c - 1000000);
if (a + b + c + d <= 2000 && d >= c)
{
fout << a / 100.0 << " " << b / 100.0 << " " << c / 100.0 << " " << d / 100.0 << '\n';
}
}
}
}
}
}
return 0;
}